/**
  * @usage $items = $this->view->partialLoopExtended('partials/index_hot.phtml', $res, array('test' => 'test2'));
  * @usage $this->view->partialLoopExtended('partials/stores_list.phtml', $rows, array('controller' => $this->view->controller));
  * @param
  * @return
  */
 public function partialLoopExtended($path, $array, $arrayExtended = null)
 {
     if (!empty($arrayExtended) && is_array($arrayExtended)) {
         $this->arrayExtended = $arrayExtended;
     }
     return parent::partialLoop($path, $array);
 }
Ejemplo n.º 2
0
 /**
  * @see ZF-7157
  */
 public function testPartialLoopSetsTotalCount()
 {
     $data = array(array('message' => 'foo'), array('message' => 'bar'), array('message' => 'baz'), array('message' => 'bat'));
     $view = new Zend_View(array('scriptPath' => $this->basePath . '/default/views/scripts'));
     $this->helper->setView($view);
     $result = $this->helper->partialLoop('partialLoopCouter.phtml', $data);
     foreach ($data as $key => $item) {
         $string = 'Total count: ' . count($data);
         $this->assertContains($string, $result);
     }
 }
Ejemplo n.º 3
0
 /**
  * @see ZF-3083
  */
 public function testEmptyArrayPassedToPartialLoopShouldNotThrowException()
 {
     $view = new Zend_View(array('scriptPath' => $this->basePath . '/default/views/scripts'));
     $this->helper->setView($view);
     try {
         $result = $this->helper->partialLoop('partialLoop.phtml', array());
     } catch (Exception $e) {
         $this->fail('Empty array should not cause partialLoop to throw exception');
     }
     try {
         $result = $this->helper->partialLoop('partialLoop.phtml', null, array());
     } catch (Exception $e) {
         $this->fail('Empty array should not cause partialLoop to throw exception');
     }
 }
Ejemplo n.º 4
0
 /**
  * @see ZF-5174
  * @link http://framework.zend.com/issues/browse/ZF-5174
  */
 public function testPartialLoopPartialCounterResets()
 {
     $data = array(array('message' => 'foo'), array('message' => 'bar'), array('message' => 'baz'), array('message' => 'bat'));
     $view = new Zend_View(array('scriptPath' => $this->basePath . '/default/views/scripts'));
     $this->helper->setView($view);
     $result = $this->helper->partialLoop('partialLoopCouter.phtml', $data);
     foreach ($data as $key => $item) {
         $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1);
         $this->assertContains($string, $result);
     }
     $result = $this->helper->partialLoop('partialLoopCouter.phtml', $data);
     foreach ($data as $key => $item) {
         $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1);
         $this->assertContains($string, $result);
     }
 }
Ejemplo n.º 5
0
    /**
     * @return void
     */
    public function testPartialLoopFindsModule()
    {
        Zend_Controller_Front::getInstance()->addModuleDirectory($this->basePath);
        $data = array(
            array('message' => 'foo'),
            array('message' => 'bar'),
            array('message' => 'baz'),
            array('message' => 'bat')
        );

        $view = new Zend_View(array(
            'scriptPath' => $this->basePath . '/default/views/scripts'
        ));
        $this->helper->setView($view);

        $result = $this->helper->partialLoop('partialLoop.phtml', 'foo', $data);
        foreach ($data as $item) {
            $string = 'This is an iteration in the foo module: ' . $item['message'];
            $this->assertContains($string, $result);
        }
    }
Ejemplo n.º 6
0
 public function testPassingNoArgsReturnsHelperInstance()
 {
     $test = $this->helper->partialLoop();
     $this->assertSame($this->helper, $test);
 }