/** * @group ZF-5174 */ public function testPartialLoopPartialCounterResets() { $data = array( array('message' => 'foo'), array('message' => 'bar'), array('message' => 'baz'), array('message' => 'bat') ); $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); $this->helper->setView($view); $result = $this->helper->__invoke('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->__invoke('partialLoopCouter.phtml', $data); foreach ($data as $key=>$item) { $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key+1); $this->assertContains($string, $result); } }
/** * @group ZF-5174 */ public function testPartialLoopPartialCounterResets() { $data = array(array('message' => 'foo'), array('message' => 'bar'), array('message' => 'baz'), array('message' => 'bat')); $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); $this->helper->setView($view); $this->helper->__invoke('partialLoopCouter.phtml', $data); $this->assertEquals(4, $this->helper->getPartialCounter()); $this->helper->__invoke('partialLoopCouter.phtml', $data); $this->assertEquals(4, $this->helper->getPartialCounter()); }
public function testShouldNotConvertToArrayRecursivelyIfModelIsTraversable() { $rIterator = new RecursiveIteratorTest(); for ($i = 0; $i < 5; ++$i) { $data = array('message' => 'foo' . $i); $rIterator->addItem(new IteratorTest($data)); } $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); $this->helper->setView($view); $this->helper->setObjectKey('obj'); $result = $this->helper->__invoke('partialLoopShouldNotConvertToArrayRecursively.phtml', $rIterator); foreach ($rIterator as $item) { foreach ($item as $key => $value) { $this->assertContains('This is an iteration: ' . $value, $result, var_export($value, 1)); } } }