You are here

public function HandlerTest::testBrokenHandlers in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/views_ui/src/Tests/HandlerTest.php \Drupal\views_ui\Tests\HandlerTest::testBrokenHandlers()

Tests broken handlers.

File

core/modules/views_ui/src/Tests/HandlerTest.php, line 196
Contains \Drupal\views_ui\Tests\HandlerTest.

Class

HandlerTest
Tests handler UI for views.

Namespace

Drupal\views_ui\Tests

Code

public function testBrokenHandlers() {
  $handler_types = ViewExecutable::getHandlerTypes();
  foreach ($handler_types as $type => $type_info) {
    $this
      ->drupalGet('admin/structure/views/view/test_view_broken/edit');
    $href = "admin/structure/views/nojs/handler/test_view_broken/default/{$type}/id_broken";
    $result = $this
      ->xpath('//a[contains(@href, :href)]', array(
      ':href' => $href,
    ));
    $this
      ->assertEqual(count($result), 1, SafeMarkup::format('Handler (%type) edit link found.', array(
      '%type' => $type,
    )));
    $text = 'Broken/missing handler';
    $this
      ->assertIdentical((string) $result[0], $text, 'Ensure the broken handler text was found.');
    $this
      ->drupalGet($href);
    $result = $this
      ->xpath('//h1[@class="page-title"]');
    $this
      ->assertTrue(strpos((string) $result[0], $text) !== FALSE, 'Ensure the broken handler text was found.');
    $original_configuration = [
      'field' => 'id_broken',
      'id' => 'id_broken',
      'relationship' => 'none',
      'table' => 'views_test_data',
      'plugin_id' => 'numeric',
    ];
    foreach ($original_configuration as $key => $value) {
      $this
        ->assertText(SafeMarkup::format('@key: @value', array(
        '@key' => $key,
        '@value' => $value,
      )));
    }
  }
}