You are here

protected function TaxonomyAccessFixTestTrait::assertNoSortableTable in Taxonomy access fix 8.3

Same name and namespace in other branches
  1. 8.2 tests/src/Traits/TaxonomyAccessFixTestTrait.php \Drupal\Tests\taxonomy_access_fix\Traits\TaxonomyAccessFixTestTrait::assertNoSortableTable()

Asserts that the page contains no sortable taxonomy term table.

Checks, wether the page contains a sortable table by checking for the presence of a select element to set a weight for a term.

Parameters

bool $assert_overview_page: Whether to assert no sortable table on overview page (Default). If FALSE, no sortable table on index page will be asserted.

Throws

\PHPUnit\Framework\ExpectationFailedException When the assertion failed.

2 calls to TaxonomyAccessFixTestTrait::assertNoSortableTable()
VocabularyAccessTest::testTaxonomyVocabularyCollection in tests/src/Functional/VocabularyAccessTest.php
Tests access to administrative Taxonomy Vocabulary collection.
VocabularyAccessTest::testTaxonomyVocabularyOverview in tests/src/Functional/VocabularyAccessTest.php
Tests access to Taxonomy Vocabulary overview page.

File

tests/src/Traits/TaxonomyAccessFixTestTrait.php, line 157

Class

TaxonomyAccessFixTestTrait
Provides common methods for functional tests of Taxonomy Access Fix module.

Namespace

Drupal\Tests\taxonomy_access_fix\Traits

Code

protected function assertNoSortableTable($assert_overview_page = TRUE) {
  if ($assert_overview_page) {
    $this
      ->assertSession()
      ->pageTextNotContains('Weight for added term');
  }
  else {
    foreach ($this->vocabularies as $vocabulary) {
      $this
        ->assertSession()
        ->pageTextNotContains('Weight for ' . $vocabulary
        ->label());
    }
  }
  $select_class = $assert_overview_page ? 'term-weight' : 'weight';
  $this
    ->assertNoElementByCssSelector('select.' . $select_class);
}