You are here

public function BasicTest::testWizardForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Wizard/BasicTest.php \Drupal\views\Tests\Wizard\BasicTest::testWizardForm()

Tests the actual wizard form.

See also

\Drupal\views_ui\ViewAddForm::form()

File

core/modules/views/src/Tests/Wizard/BasicTest.php, line 183
Contains \Drupal\views\Tests\Wizard\BasicTest.

Class

BasicTest
Tests creating views with the wizard and viewing them on the listing page.

Namespace

Drupal\views\Tests\Wizard

Code

public function testWizardForm() {
  $this
    ->drupalGet('admin/structure/views/add');
  $result = $this
    ->xpath('//small[@id = "edit-label-machine-name-suffix"]');
  $this
    ->assertTrue(count($result), 'Ensure that the machine name is applied to the name field.');
  $this
    ->drupalPostAjaxForm(NULL, array(
    'show[wizard_key]' => 'users',
  ), 'show[wizard_key]');
  $this
    ->assertNoFieldByName('show[type]', NULL, 'The "of type" filter is not added for users.');
  $this
    ->drupalPostAjaxForm(NULL, array(
    'show[wizard_key]' => 'node',
  ), 'show[wizard_key]');
  $this
    ->assertNoFieldByName('show[type]', 'all', 'The "of type" filter is not added for nodes when there are no node types.');
  $this
    ->drupalCreateContentType(array(
    'type' => 'page',
  ));
  $this
    ->drupalPostAjaxForm(NULL, array(
    'show[wizard_key]' => 'node',
  ), 'show[wizard_key]');
  $this
    ->assertFieldByName('show[type]', 'all', 'The "of type" filter is added for nodes when there is at least one node type.');
}