Perforce Chronicle 2012.2/486814
API Documentation
|
Test the menu breadcrumbs viewhelper. More...
Public Member Functions | |
setup () | |
Test setup. | |
testHtmlifyWithoutPage () | |
Test htmlify() without a page. | |
testHtmlifyWithPage () | |
Test htmlify() with a page. | |
testInstantiation () | |
Test instantiation. |
Test the menu breadcrumbs viewhelper.
Menu_Test_BreadcrumbsHelperTest::setup | ( | ) |
Test setup.
{ parent::setup(); $this->_view = Zend_Layout::getMvcInstance()->getView(); $this->utility->impersonate('administrator'); }
Menu_Test_BreadcrumbsHelperTest::testHtmlifyWithoutPage | ( | ) |
Test htmlify() without a page.
PHPUnit_Framework_Error
{ $helper = new Menu_View_Helper_Breadcrumbs; $helper->setView($this->_view); $helper->htmlify(); }
Menu_Test_BreadcrumbsHelperTest::testHtmlifyWithPage | ( | ) |
Test htmlify() with a page.
{ $helper = new Menu_View_Helper_Breadcrumbs; $helper->setView($this->_view); $pages = array( array( 'type' => 'uri', 'options' => array( 'id' => 'menu_1', 'label' => 'Menu Item 1', ), 'result' => 'Menu Item 1', ), array( 'type' => 'uri', 'options' => array( 'id' => 'menu_2', 'label' => 'Menu Item 2', 'uri' => 'menu_2' ), 'result' => '<a id="breadcrumbs-menu_2" href="menu_2">Menu Item 2</a>', ), array( 'type' => 'mvc', 'options' => array( 'id' => 'menu_3', 'label' => 'Menu Item 3', ), 'result' => '<a id="breadcrumbs-menu_3" href="/">Menu Item 3</a>', ), array( 'type' => 'mvc', 'options' => array( 'id' => 'menu_4', 'label' => 'Menu Item 4', 'module' => 'module_4' ), 'result' => '<a id="breadcrumbs-menu_4" href="/module_4">Menu Item 4</a>', ), array( 'type' => 'mvc', 'options' => array( 'id' => 'menu_5', 'label' => 'Menu Item 5', 'module' => 'module5', 'controller' => 'controller5' ), 'result' => '<a id="breadcrumbs-menu_5" href="/module5/controller5">Menu Item 5</a>', ), array( 'type' => 'mvc', 'options' => array( 'id' => 'menu_6', 'label' => 'Menu Item 6', 'module' => 'module6', 'controller' => 'controller6', 'action' => 'action6' ), 'result' => '<a id="breadcrumbs-menu_6" href="/module6/controller6/action6">Menu Item 6</a>', ), ); foreach ($pages as $page) { switch ($page['type']) { case 'uri': $p = new Zend_Navigation_Page_Uri($page['options']); break; case 'mvc': $p = new Zend_Navigation_Page_Mvc($page['options']); break; default: break; } $this->assertSame($page['result'], $helper->htmlify($p)); } }
Menu_Test_BreadcrumbsHelperTest::testInstantiation | ( | ) |
Test instantiation.
{ $helper = new Menu_View_Helper_Breadcrumbs; $helper->setView($this->_view); $this->assertTrue($helper instanceof Menu_View_Helper_Breadcrumbs, 'Expected class'); }