|
Perforce Chronicle 2012.2/486814
API Documentation
|
Test the MVC menu item form. More...
Public Member Functions | |
| testGetValues () | |
| Test handling when params are all strings. | |
| testSetDefaultsParamsArray () | |
| Test handling when params is an array instead of a config string. | |
| testSetDefaultsRouteSplit () | |
| Test handling when route is split into its parts instead of a single action string. | |
Test the MVC menu item form.
| Menu_Test_MenuItemMvcFormTest::testGetValues | ( | ) |
Test handling when params are all strings.
{
$form = new Menu_Form_MenuItemMvc();
$module = 'menu';
$controller = 'index';
$action = 'index';
$defaults = array(
'menuId' => 'testmenu',
'id' => 'testitem',
'uuid' => 'testitem',
'label' => 'testItem',
'position' => 'under',
'location' => 'testmenu',
'type' => 'P4Cms_Navigation_Page_Mvc',
'action' => $module . '/' . $controller . '/' . $action,
'params' => 'format=json'
);
$formatArray = array('format' => 'json');
$form->setDefaults($defaults);
$values = $form->getValues();
$this->assertEquals($values['module'], $module);
$this->assertEquals($values['controller'], $controller);
$this->assertEquals($values['action'], $action);
$this->assertEquals($values['params'], $formatArray);
$this->assertEquals($values['label'], $defaults['label']);
}
| Menu_Test_MenuItemMvcFormTest::testSetDefaultsParamsArray | ( | ) |
Test handling when params is an array instead of a config string.
{
$form = new Menu_Form_MenuItemMvc();
$defaults = array(
'menuId' => 'testmenu',
'id' => 'testitem',
'uuid' => 'testitem',
'label' => 'testItem',
'position' => 'under',
'location' => 'testmenu',
'type' => 'P4Cms_Navigation_Page_Mvc',
'action' => 'menu/index/index',
'params' => array(
'format' => 'json'
)
);
$form->setDefaults($defaults);
$params = $form->getValue('params');
$this->assertTrue(is_string($params));
}
| Menu_Test_MenuItemMvcFormTest::testSetDefaultsRouteSplit | ( | ) |
Test handling when route is split into its parts instead of a single action string.
{
$form = new Menu_Form_MenuItemMvc();
$module = 'menu';
$controller = 'index';
$action = 'index';
$defaults = array(
'menuId' => 'testmenu',
'id' => 'testitem',
'uuid' => 'testitem',
'label' => 'testItem',
'position' => 'under',
'location' => 'testmenu',
'type' => 'P4Cms_Navigation_Page_Mvc',
'module' => $module,
'controller'=> $controller,
'action' => $action,
'params' => array(
'format' => 'json'
)
);
$form->setDefaults($defaults);
$value = $form->getValue('action');
$this->assertEquals($value, $module . '/' . $controller . '/' . $action);
}