Perforce Chronicle 2012.2/486814
API Documentation
|
Test the menu widget controller. More...
Public Member Functions | |
testDefaultMenu () | |
Test index action with default menu. | |
testEmptyMenu () | |
Test the index action with empty menu. | |
testGetConfigSubForm () | |
Test getting the subform. |
Test the menu widget controller.
Menu_Test_WidgetControllerTest::testDefaultMenu | ( | ) |
Test index action with default menu.
{ $this->utility->impersonate('administrator'); P4Cms_Widget::installDefaults(); P4Cms_Menu::installDefaultMenus(); $widget = P4Cms_Widget::factory('menu/widget'); $widget->setValue('region', 'test')->save(); $widget->setConfigFromArray(array('menu' => 'manage-toolbar'))->save(); $this->dispatch('/widget/region/test/widget/' . $widget->getId()); $this->assertModule('widget', 'Expected module.'); $this->assertController('index', 'Expected controller'); $this->assertAction('index', 'Expected action'); $this->assertQuery('div.widget-menu-widget', 'Expected menu widget div'); $this->assertXpath( '//div[@id="widget-' . $widget->getId() . '-content"]', 'Expected menu widget content div' ); }
Menu_Test_WidgetControllerTest::testEmptyMenu | ( | ) |
Test the index action with empty menu.
{ $this->utility->impersonate('administrator'); P4Cms_Widget::installDefaults(); $widget = P4Cms_Widget::factory('menu/widget'); $widget->setValue('region', 'test')->save(); $this->dispatch('/widget/region/test/widget/' . $widget->getId()); $this->assertModule('widget', 'Expected module.'); $this->assertController('index', 'Expected controller'); $this->assertAction('index', 'Expected action'); $this->assertQuery('div.widget-menu-widget', 'Expected menu widget div'); $this->assertQueryContentContains( 'div#widget-' . $widget->getId() . '-content', 'No items to display.', 'Expected no items message.' ); }
Menu_Test_WidgetControllerTest::testGetConfigSubForm | ( | ) |
Test getting the subform.
{ $this->utility->impersonate('administrator'); P4Cms_Widget::installDefaults(); P4Cms_Menu::installDefaultMenus(); $widget = P4Cms_Widget::factory('menu/widget'); $widget->setValue('region', 'test')->save(); $this->dispatch('/widget/index/configure/region/test/widget/' . $widget->getId()); $this->assertModule('widget', 'Expected module.'); $this->assertController('index', 'Expected controller'); $this->assertAction('configure', 'Expected action'); $this->assertXpath('//select[@name="config[menu]"]', 'Expected menu select element'); $this->assertXpath('//select[@name="config[root]"]', 'Expected root select element'); $this->assertXpath('//select[@name="config[maxDepth]"]', 'Expected maxDepth select element'); $this->assertXpath('//select[@name="config[maxItems]"]', 'Expected maxItems select element'); }