You are here

function SkinrUIPluginViewsTestCase::testViews in Skinr 7.2

Same name and namespace in other branches
  1. 8.2 skinr_ui/src/Tests/skinr_ui.test \SkinrUIPluginViewsTestCase::testViews()

Tests views plugin.

File

tests/skinr_ui.test, line 743
Tests for the Skinr UI module.

Class

SkinrUIPluginViewsTestCase
Tests UI functionality for Block plugin.

Code

function testViews() {
  $default_theme = variable_get('theme_default', 'bartik');

  // Go to the view's page.
  $this
    ->drupalGet('skinr-ui-test-view');

  // Make sure our contextual link appears on the page.
  $this
    ->assertLinkByHref('admin/structure/skinr/edit/views/skinr_ui_test__page/configure', 0, "Contexual link to edit view's skin configuration was found.");

  // Make sure this view's options are returned.
  $this
    ->drupalGet('admin/structure/skinr/add');
  $this
    ->assertOptionExists('element', 'skinr_ui_test__default', 'Default display for our view was returned by views_skinr_ui_element_options().');
  $this
    ->assertOptionExists('element', 'skinr_ui_test__page', 'Page display for our view was returned by views_skinr_ui_element_options().');

  // Test the returned element title.
  $skin = (object) array(
    'theme' => $default_theme,
    'module' => 'views',
    'element' => 'skinr_ui_test__page',
    'skin' => 'skinr_ui_test_bgcolor',
    'options' => array(
      'bgcolor_red',
    ),
    'status' => 1,
  );
  skinr_skin_save($skin);
  $title = skinr_invoke_all('skinr_ui_element_title', $skin->module, $skin->element, $skin->theme);
  $title = reset($title);
  $this
    ->assertEqual($title, 'Skinr UI Test', 'View title was returned.');
}