You are here

function FusionApplyUIPluginPanelsTestCase::testPanelsDatabase in Fusion Accelerator 7

Same name and namespace in other branches
  1. 7.2 fusion_apply/tests/fusion_apply_ui.test \FusionApplyUIPluginPanelsTestCase::testPanelsDatabase()

Tests panels plugin.

File

fusion_apply/tests/fusion_apply_ui.test, line 531
Tests for the Fusion Apply UI module.

Class

FusionApplyUIPluginPanelsTestCase
Tests UI functionality for Block plugin.

Code

function testPanelsDatabase() {

  // Create a simple panel node.
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'panel',
    'panels_node' => array(
      'layout' => 'onecol',
      'css_id' => '',
      'pipeline' => 'standard',
    ),
  ));

  // Add a block to our panel node.
  $display = panels_load_display($node->panels_node['did']);
  $pane = panels_new_pane('block', 'system-user-menu', TRUE);
  $display
    ->add_pane($pane, 'middle');
  $this
    ->assertTrue(panels_save_display($display), 'Block was successfully added to panel node.');

  // Go to node.
  $uri = entity_uri('node', $node);
  $this
    ->drupalGet($uri['path']);

  // Make sure our contextual link appears on the page.
  // @todo Is there a better way to determine did and pid used for this panel?
  $this
    ->assertLinkByHref('admin/appearance/fusion/edit/nojs/panels/pane__1__1/configure', 0, 'Contexual link to edit pane\'s skin configuration on panel node was found.');

  // Test panels pages.
  // Save page to DB.
  $task = page_manager_get_task('page');
  $handler = page_manager_load_task_handler($task, 'fusion_apply_ui_test', 'page_fusion_apply_ui_test_panel_context');
  page_manager_save_task_handler($handler);

  // Go to panel page.
  $this
    ->drupalGet('fusion_apply-ui-test-panel');

  // Make sure our contextual link appears on the page.
  $this
    ->assertLinkByHref('admin/appearance/fusion/edit/nojs/panels/pane__2__2/configure', 0, "Contexual link to edit pane's skin configuration on panel page (stored in DB) was found.");
  $this
    ->drupalGet('admin/structure/mini-panels');

  // Test mini panels.
  // Save mini panel to DB.
  $mini = panels_mini_load('fusion_apply_ui_test_mini_panel');
  panels_mini_save($mini);

  // Add the mini block to the sidebar.
  $default_theme = variable_get('theme_default', 'bartik');
  db_merge('block')
    ->key(array(
    'theme' => $default_theme,
    'module' => 'panels_mini',
    'delta' => 'fusion_apply_ui_test_mini_panel',
  ))
    ->fields(array(
    'status' => 1,
    'region' => 'sidebar_first',
    'pages' => '',
  ))
    ->execute();

  // Go front page.
  $this
    ->drupalGet('');

  // Make sure our contextual link appears on the page.
  // @todo Is there a better way to determine did and pid used for this panel?
  $this
    ->assertLinkByHref('admin/appearance/fusion/edit/nojs/panels/pane__3__3/configure', 0, 'Contexual link to edit pane\'s skin configuration on mini panel (stored in DB) was found.');
}