You are here

protected function TaxonomyAccessFixTestTrait::assertSortableTable 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::assertSortableTable()

Asserts that the page contains a 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 sortable table on overview page (Default). If FALSE, sortable table on index page will be asserted.

Throws

\PHPUnit\Framework\ExpectationFailedException When the assertion failed.

2 calls to TaxonomyAccessFixTestTrait::assertSortableTable()
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 131

Class

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

Namespace

Drupal\Tests\taxonomy_access_fix\Traits

Code

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