You are here

public function IntegrationTest::testBlockDelete in Facets 8

Same name in this branch
  1. 8 tests/src/Functional/IntegrationTest.php \Drupal\Tests\facets\Functional\IntegrationTest::testBlockDelete()
  2. 8 modules/facets_summary/tests/src/Functional/IntegrationTest.php \Drupal\Tests\facets_summary\Functional\IntegrationTest::testBlockDelete()

Tests for deleting a block.

File

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

Class

IntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\facets\Functional

Code

public function testBlockDelete() {
  $name = 'Tawny-browed owl';
  $id = 'tawny_browed_owl';

  // Add a new facet.
  $this
    ->createFacet($name, $id);
  $block = $this->blocks[$id];
  $block_id = $block
    ->label();
  $this
    ->drupalGet('admin/structure/block');
  $this
    ->assertSession()
    ->pageTextContains($block_id);
  $this
    ->drupalGet('admin/structure/block/library/stark');
  $this
    ->assertSession()
    ->pageTextContains($name);
  $this
    ->drupalGet('admin/config/search/facets/' . $id . '/delete');
  $this
    ->assertSession()
    ->pageTextContains('The listed configuration will be deleted.');
  $this
    ->assertSession()
    ->pageTextContains($block
    ->label());
  $this
    ->drupalPostForm(NULL, [], 'Delete');
  $this
    ->drupalGet('admin/structure/block/library/stark');
  $this
    ->assertSession()
    ->pageTextNotContains($name);
}