You are here

public function ConfigurationHandlerPageManagerTestCase::testImportToActiveStore in Configuration Management 7.2

File

tests/handlers/page_manager.test, line 46
Tests for Configuration Management: Page Manager Components.

Class

ConfigurationHandlerPageManagerTestCase
Base class for functional tests for configuration management.

Code

public function testImportToActiveStore() {

  // Change the path from where the configurations are loaded.
  ConfigurationManagement::setStream(drupal_get_path('module', 'configuration') . '/tests/test_configs/');

  // Page Manager with view as dependency.
  $config = 'page_manager_pages.configuration_test_page';
  $results = ConfigurationManagement::importToActiveStore(array(
    $config,
  ), TRUE, TRUE);
  $imported = $results
    ->getInfo('imported');
  $this
    ->assertTrue(in_array($config, $imported), "Configuration for {$config} was imported.");
  $dependencies = array();
  $dependencies[] = 'page_manager_handlers.page_configuration_test_page_panel_context';
  $dependencies[] = 'views_view.test';
  foreach ($dependencies as $component) {
    $this
      ->assertTrue(in_array($component, $imported), "Dependency {$component} was imported.");
  }
  $view_exists = views_get_view('test');
  $this
    ->assertTrue(!empty($view_exists->name), "The view was saved in the ActiveStore.");
  $web_user = $this
    ->drupalCreateUser(array(
    'access content',
    'use page manager',
  ));
  $this
    ->drupalLogin($web_user);
  $this
    ->drupalGet('admin/structure/pages');
  $this
    ->assertRaw('Configuration Test Page', 'Page Manager Page was created correctly.');
}