在Zend公司,模型添加到視圖設置:單元測試Zend的控制器 - 我怎麼考什麼已經在視圖
//In a controller
public function indexAction() {
//Do some work and get a model
$this->view->model = $model;
}
我們可以方便地查看「模型」視圖中的存在(我「M使用此SimpleTest的):
//In a unit test
public function testModelIsSetInView() {
//Call the controllers index action
$this->assertTrue(isset($this->controller->view->model));
}
然而,在測試 「價值」 不工作,以及:
//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'));
}
如何獲取(或LEA st測試)控制器已經設置了一個有效的模型?