CakePHP 2.0의 기본 저장 메소드 테스트 케이스에 필요한 어설 션을 도와 줄 사람이 있습니까? 기본 "Save/Submit"모델 테스트 케이스에는 어떤 주장/테스트가 필요합니까?
I 제품, 사용자 및 뉴스 모델, 내가News
모델의
submit
방법에 대한 테스트 케이스를 작성 찾고 있어요 난 그냥 궁금 해서요 포함하는 많은 방법/가지가 무엇을 실제로 필요한 어떤 ISN '티. 모든 모델에 기본 조명기 설정이 있습니다.
내가 테스트를 효과적으로이 될 것입니다 해요 방법 :
class News extends AppModel {
public submit($productId, $userId, $newsData) {
// Logic which checks for user and products existence, saves and returns submitted row
}
}
테스트 케이스
public function testSubmit() {
// Save News
$newsData = array(
'News' => array(
'title' => 'Here is the title of the news',
'body' => 'Here is the news body',
'source' => 'News came from here'
)
);
$news = $this->News->submit('product-1', 'user-1', $newsData);
// Now what?
}