In Zend, models are added to the view:
//In a controller
public function indexAction() {
//Do some work and get a model
$this->view->model = $model;
}
We can easily check that "model" exists in the view (I'm using simpletest for this):
//In a unit test
public function testModelIsSetInView() {
//Call the controllers index action
$this->assertTrue(isset($this->controller->view->model));
}
However, testing the "value" doesn't work as well:
//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'));
}
How do I get (or at least test) that the controller has set a valid model?