You are here

public function CoreViewsIntegrationTest::testFacetFormValidate in Core Views Facets 8

Test that a missing facet source field selection prevents facet creation.

File

tests/src/Functional/CoreViewsIntegrationTest.php, line 95

Class

CoreViewsIntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\core_views_facets\Functional

Code

public function testFacetFormValidate() {
  $id = 'southern_white_facet_owl';
  $name = 'Southern white-faced owl';
  $facet_add_page = Url::fromRoute('entity.facets_facet.add_form');
  $this
    ->drupalGet($facet_add_page);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $edit = [
    'name' => $name,
    'id' => $id,
    'facet_source_id' => $this->exposedFiltersFacetSourceId,
  ];
  $this
    ->drupalPostForm(NULL, $edit, 'Save');
  $this
    ->assertSession()
    ->responseContains('Please select a valid field.');
}