Example #1
0
 public function testObjectModelSetInObjectKeyWhenKeyPresent()
 {
     $this->helper->setObjectKey('foo');
     $model = new \stdClass();
     $model->footest = 'bar';
     $model->bartest = 'baz';
     $view = new View\View(array('scriptPath' => $this->basePath . '/default/views/scripts'));
     $this->helper->setView($view);
     $return = $this->helper->direct('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}'");
     }
 }
Example #2
0
    public function testObjectModelWithToArraySetsViewVariables()
    {
        $model = new Zend_View_Helper_PartialTest_Aggregate();

        $view = new Zend_View(array(
            'scriptPath' => $this->basePath . '/default/views/scripts'
        ));
        $this->helper->setView($view);
        $return = $this->helper->partial('partialVars.phtml', $model);

        foreach ($model->toArray() as $key => $value) {
            $string = sprintf('%s: %s', $key, $value);
            $this->assertContains($string, $return);
        }
    }
Example #3
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'");
        }
    }
Example #4
0
 /**
  * @group ZF-2716
  */
 public function testActionWithPartialsUseOfViewRendererReturnsToOriginatingViewState()
 {
     require_once 'Zend/View/Helper/Partial.php';
     $partial = new Zend_View_Helper_Partial();
     $this->view->setScriptPath(dirname(__FILE__) . '/_files/modules/default/views/scripts/');
     $partial->setView($this->view);
     Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view = $this->view;
     $partial->partial('partialActionCall.phtml');
     $this->assertSame($this->view, Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->view);
 }