이 모델은 뷰에 추가 된 뷰에 설정되어있는 것을 테스트하는 방법은 다음과 같습니다단위 테스트 젠드 컨트롤러 - 나는 젠드에서
//In a controller
public function indexAction() {
//Do some work and get a model
$this->view->model = $model;
}
우리는 쉽게 "모델은"보기에 있는지 (I를 확인하실 수 있습니다 뿐만 아니라 작동하지 않습니다 "값을"테스트, 그러나
//In a unit test
public function testModelIsSetInView() {
//Call the controllers index action
$this->assertTrue(isset($this->controller->view->model));
}
: 이것에 대한 simpletest)를 사용하고 있습니다
//In a unit test
public function testModelValue() {
//Call the controllers index action
//Both of these return null, though I'd like to access them!
$this->assertNull($this->controller->view->model);
$this->assertNull($this->controller->view->__get('model'));
}
내가 어떻게합니까 (또는 숨기려 st 테스트) 컨트롤러가 유효한 모델을 설정 했습니까?