Пример #1
0
 /**
  * @see ZF-3350
  * @see ZF-3352
  */
 public function testShouldNotCastToArrayIfObjectIsTraversable()
 {
     $data = array(new IteratorWithToArrayTestContainer(array('message' => 'foo')), new IteratorWithToArrayTestContainer(array('message' => 'bar')), new IteratorWithToArrayTestContainer(array('message' => 'baz')), new IteratorWithToArrayTestContainer(array('message' => 'bat')));
     $o = new IteratorWithToArrayTest($data);
     $view = new View\View(array('scriptPath' => $this->basePath . '/application/views/scripts'));
     $this->helper->setView($view);
     $this->helper->setObjectKey('obj');
     $result = $this->helper->direct('partialLoopObject.phtml', $o);
     foreach ($data as $item) {
         $string = 'This is an iteration: ' . $item->message;
         $this->assertContains($string, $result, $result);
     }
 }