Esempio n. 1
0
 public function testFindAllRelations()
 {
     $expectedRelations = array('alternate' => array('Forced page'), 'stylesheet' => array('Forced page'), 'start' => array('Forced page'), 'next' => array('Forced page'), 'prev' => array('Forced page'), 'contents' => array('Forced page'), 'index' => array('Forced page'), 'glossary' => array('Forced page'), 'copyright' => array('Forced page'), 'chapter' => array('Forced page'), 'section' => array('Forced page'), 'subsection' => array('Forced page'), 'appendix' => array('Forced page'), 'help' => array('Forced page'), 'bookmark' => array('Forced page'), 'canonical' => array('Forced page'), 'home' => array('Forced page'));
     // build expected result
     $expected = array('rel' => $expectedRelations, 'rev' => $expectedRelations);
     // find active page and create page to use for relations
     $active = $this->_helper->findOneByLabel('Page 1');
     $forcedRelation = new Zend_Navigation_Page_Uri(array('label' => 'Forced page', 'uri' => '#'));
     // add relations to active page
     foreach ($expectedRelations as $type => $discard) {
         $active->addRel($type, $forcedRelation);
         $active->addRev($type, $forcedRelation);
     }
     // build actual result
     $actual = $this->_helper->findAllRelations($active);
     foreach ($actual as $attrib => $relations) {
         foreach ($relations as $type => $pages) {
             foreach ($pages as $key => $page) {
                 $actual[$attrib][$type][$key] = $page->getLabel();
             }
         }
     }
     $this->assertEquals($expected, $actual);
 }