You are here

function AnalyzeTest::testAnalyzeBasic in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views_ui/src/Tests/AnalyzeTest.php \Drupal\views_ui\Tests\AnalyzeTest::testAnalyzeBasic()

Tests that analyze works in general.

File

core/modules/views_ui/src/Tests/AnalyzeTest.php, line 45
Contains \Drupal\views_ui\Tests\AnalyzeTest.

Class

AnalyzeTest
Tests the views analyze system.

Namespace

Drupal\views_ui\Tests

Code

function testAnalyzeBasic() {
  $this
    ->drupalLogin($this->admin);
  $this
    ->drupalGet('admin/structure/views/view/test_view/edit');
  $this
    ->assertLink(t('Analyze view'));

  // This redirects the user to the analyze form.
  $this
    ->clickLink(t('Analyze view'));
  $this
    ->assertText(t('View analysis'));
  foreach (array(
    'ok',
    'warning',
    'error',
  ) as $type) {
    $xpath = $this
      ->xpath('//div[contains(@class, :class)]', array(
      ':class' => $type,
    ));
    $this
      ->assertTrue(count($xpath), format_string('Analyse messages with @type found', array(
      '@type' => $type,
    )));
  }

  // This redirects the user back to the main views edit page.
  $this
    ->drupalPostForm(NULL, array(), t('Ok'));
}