public function ConfigurationHandlerPageManagerTestCase::testExportToDataStore in Configuration Management 7.2
File
- tests/
handlers/ page_manager.test, line 73 - Tests for Configuration Management: Page Manager Components.
Class
- ConfigurationHandlerPageManagerTestCase
- Base class for functional tests for configuration management.
Code
public function testExportToDataStore() {
variable_set('configuration_config_path', $this->datastore_path);
$config_path = variable_get('configuration_config_path', $this->datastore_path);
file_prepare_directory($config_path);
ConfigurationManagement::setStream($config_path);
$custom_menu = array(
'menu_name' => 'menu-configuration-test-menu',
'title' => 'Configuration Test Menu',
'description' => 'A menu to test a configuration handler.',
);
$custom_menu_link = array(
'menu_name' => 'menu-configuration-test-menu',
'mlid' => '218',
'plid' => '0',
'link_path' => '<front>',
'router_path' => '',
'link_title' => 'Top Level link 1',
'options' => array(
'attributes' => array(
'title' => '',
),
),
'module' => 'menu',
'hidden' => '0',
'external' => '1',
'has_children' => '1',
'expanded' => '0',
'weight' => '0',
'depth' => '1',
'customized' => '1',
'p1' => '218',
'p2' => '0',
'p3' => '0',
'p4' => '0',
'p5' => '0',
'p6' => '0',
'p7' => '0',
'p8' => '0',
'p9' => '0',
'updated' => '0',
'path' => NULL,
'load_functions' => NULL,
'to_arg_functions' => NULL,
'access_callback' => NULL,
'access_arguments' => NULL,
'page_callback' => NULL,
'page_arguments' => NULL,
'delivery_callback' => NULL,
'fit' => NULL,
'number_parts' => NULL,
'context' => NULL,
'tab_parent' => NULL,
'tab_root' => NULL,
'title' => 'Top Level link 1',
'title_callback' => NULL,
'title_arguments' => NULL,
'theme_callback' => NULL,
'theme_arguments' => NULL,
'type' => NULL,
'description' => NULL,
'position' => NULL,
'include_file' => NULL,
'link_weight' => '0',
'access' => 1,
'href' => '<front>',
'localized_options' => array(
'attributes' => array(
'title' => '',
),
),
);
menu_save($custom_menu);
$menu_exists = menu_load('menu-configuration-test-menu');
$this
->assertTrue($menu_exists, "The menu was created in the ActiveStore.");
$this
->assertTrue(menu_link_save($custom_menu_link), "The menu link was created in the ActiveStore.");
$config = 'menu_link.menu-configuration-test-menu.218.Top_Level_link_1';
$results = ConfigurationManagement::exportToDataStore(array(
$config,
), TRUE, TRUE);
$exported = $results
->getInfo('exported');
$this
->assertTrue(in_array('menu_link.menu-configuration-test-menu.218.Top_Level_link_1', $exported), "Configuration for menu_link.menu-configuration-test-menu.218.Top_Level_link_1 was exported.");
$this
->assertTrue(in_array('menu.menu-configuration-test-menu', $exported), "Configuration for menu.menu-configuration-test-menu was exported.");
$file_for_config = $config_path . 'menu_link.menu-configuration-test-menu.218.Top_Level_link_1.inc';
$this
->assertTrue(file_exists($file_for_config), "The file that storages the menu link was created.");
$file_for_config = $config_path . 'menu.menu-configuration-test-menu.inc';
$this
->assertTrue(file_exists($file_for_config), "The file that storages the menu was created.");
}