Пример #1
0
 public function testCanPassViewModelAsSoleArgument()
 {
     $model = new ViewModel(array('foo' => 'bar', 'bar' => 'baz'));
     $model->setTemplate('partialVars.phtml');
     $view = new View();
     $view->resolver()->addPath($this->basePath . '/application/views/scripts');
     $this->helper->setView($view);
     $return = $this->helper->__invoke($model);
     foreach ($model->getVariables() as $key => $value) {
         $string = sprintf('%s: %s', $key, $value);
         $this->assertContains($string, $return);
     }
 }
Пример #2
0
 public function testObjectModelSetInObjectKeyWhenKeyPresent()
 {
     $this->helper->setObjectKey('foo');
     $model = new \stdClass();
     $model->footest = 'bar';
     $model->bartest = 'baz';
     $view = new View();
     $view->resolver()->addPath($this->basePath . '/application/views/scripts');
     $this->helper->setView($view);
     $return = $this->helper->__invoke('partialObj.phtml', $model);
     $this->assertNotContains('No object model passed', $return);
     foreach (get_object_vars($model) as $key => $value) {
         $string = sprintf('%s: %s', $key, $value);
         $this->assertContains($string, $return, "Checking for '{$return}' containing '{$string}'");
     }
 }