You are here

protected function IntegrationTest::deleteUsedFacet in Facets 8

Deletes a facet through the UI that still has usages.

Parameters

string $facet_name: The name of the facet.

File

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

Class

IntegrationTest
Tests the overall functionality of the Facets admin UI.

Namespace

Drupal\Tests\facets\Functional

Code

protected function deleteUsedFacet($facet_name) {
  $facet_id = $this
    ->convertNameToMachineName($facet_name);
  $facet_delete_page = '/admin/config/search/facets/' . $facet_id . '/delete';

  // Go to the facet delete page and make the warning is shown.
  $this
    ->drupalGet($facet_delete_page);
  $this
    ->assertSession()
    ->statusCodeEquals(200);

  // Check that the facet by testing for the message and the absence of the
  // facet name on the overview.
  $this
    ->assertSession()
    ->responseContains("The facet is currently used in a block and thus can't be removed. Remove the block first.");
}