public function ConfigurationHandlerMenuLinksTestCase::testImportToActiveStore in Configuration Management 7.2
File
- tests/
handlers/ menu_links.test, line 47 - Tests for Configuration Management: Content Types.
Class
- ConfigurationHandlerMenuLinksTestCase
- Base class for functional tests for configuration management.
Code
public function testImportToActiveStore() {
// Change the path from where the configurations are loaded.
$source = drupal_get_path('module', 'configuration') . '/tests/test_configs/';
// Import the third level, import dependencies too.
$config = 'menu_link.f3aa4e71405f1a252d229e24df23187f5c0eef24';
$results = ConfigurationManagement::importToActiveStore(array(
$config,
), TRUE, FALSE, FALSE, $source);
$imported = $results
->getInfo('imported');
$level_one = 'menu_link.a6d0f08452ba53fd1b8cf291ed73479f86c70552';
$level_two = 'menu_link.3bd4fee5d9b3477e3f30a17def41c14b99bdd3b8';
$this
->assertTrue(in_array($config, $imported), "Configuration for {$config} was imported.");
$this
->assertTrue(in_array($level_two, $imported) && in_array($level_one, $imported), "Parents of the menu link also imported.");
$imported_menu_links = db_query('SELECT COUNT(*) FROM {menu_links} WHERE menu_name = :menu_name', array(
':menu_name' => 'menu-test',
))
->fetchField();
$this
->assertTrue($imported_menu_links == 3, "The three menus were saved in the ActiveStore.");
$num_rows = db_select('menu_links', 'ml')
->fields('ml')
->condition('link_title', 'Level Two')
->condition('hidden', '1')
->execute()
->rowCount();
$this
->assertTrue($num_rows == 1, "Disabled menu item successfully imported");
}