You are here

public function IntegrationTest::testClone in Facets 8

Tests cloning of a facet.

File

tests/src/Functional/IntegrationTest.php, line 809

Class

IntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\facets\Functional

Code

public function testClone() {
  $id = "western_screech_owl";
  $name = "Western screech owl";
  $this
    ->createFacet($name, $id);
  $this
    ->drupalGet('admin/config/search/facets');
  $this
    ->assertSession()
    ->pageTextContains('Western screech owl');
  $this
    ->assertSession()
    ->linkExists('Clone facet');
  $this
    ->clickLink('Clone facet');
  $clone_edit = [
    'destination_facet_source' => 'search_api:views_block__search_api_test_view__block_1',
    'name' => 'Eastern screech owl',
    'id' => 'eastern_screech_owl',
  ];
  $this
    ->submitForm($clone_edit, 'Duplicate');
  $this
    ->assertSession()
    ->pageTextContains('Facet cloned to Eastern screech owl');
  $this
    ->drupalGet('admin/config/search/facets');
  $this
    ->assertSession()
    ->pageTextContains('Western screech owl');
  $this
    ->assertSession()
    ->pageTextContains('Eastern screech owl');
}