class TaxonomyTermPagerTest
Same name and namespace in other branches
- 11.x core/modules/taxonomy/tests/src/Functional/TaxonomyTermPagerTest.php \Drupal\Tests\taxonomy\Functional\TaxonomyTermPagerTest
- 10 core/modules/taxonomy/tests/src/Functional/TaxonomyTermPagerTest.php \Drupal\Tests\taxonomy\Functional\TaxonomyTermPagerTest
- 8.9.x core/modules/taxonomy/tests/src/Functional/TaxonomyTermPagerTest.php \Drupal\Tests\taxonomy\Functional\TaxonomyTermPagerTest
Ensures that the term pager works properly.
@group taxonomy
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\FunctionalTests\AssertLegacyTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\taxonomy\Functional\TaxonomyTestBase uses \Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait, \Drupal\Tests\field\Traits\EntityReferenceTestTrait extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\taxonomy\Functional\TaxonomyTermPagerTest extends \Drupal\Tests\taxonomy\Functional\TaxonomyTestBase
- class \Drupal\Tests\taxonomy\Functional\TaxonomyTestBase uses \Drupal\Tests\taxonomy\Traits\TaxonomyTestTrait, \Drupal\Tests\field\Traits\EntityReferenceTestTrait extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of TaxonomyTermPagerTest
File
-
core/
modules/ taxonomy/ tests/ src/ Functional/ TaxonomyTermPagerTest.php, line 10
Namespace
Drupal\Tests\taxonomy\FunctionalView source
class TaxonomyTermPagerTest extends TaxonomyTestBase {
/**
* Modules to enable.
*
* @var array
*/
protected static $modules = [
'taxonomy',
];
/**
* {@inheritdoc}
*/
protected $defaultTheme = 'stark';
/**
* Vocabulary for testing.
*
* @var \Drupal\taxonomy\VocabularyInterface
*/
protected $vocabulary;
/**
* {@inheritdoc}
*/
protected function setUp() : void {
parent::setUp();
$this->drupalLogin($this->drupalCreateUser([
'administer taxonomy',
'bypass node access',
]));
$this->vocabulary = $this->createVocabulary();
}
/**
* Tests that the pager is displayed properly on the term overview page.
*/
public function testTaxonomyTermOverviewPager() {
// Set limit to 3 terms per page.
$this->config('taxonomy.settings')
->set('terms_per_page_admin', '3')
->save();
// Create 3 terms.
for ($x = 1; $x <= 3; $x++) {
$this->createTerm($this->vocabulary);
}
// Get Page 1.
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary
->id() . '/overview');
// Pager should not be visible.
$this->assertSession()
->responseNotMatches('|<nav class="pager" [^>]*>|');
// Create 3 more terms to show pager.
for ($x = 1; $x <= 3; $x++) {
$this->createTerm($this->vocabulary);
}
// Ensure that pager is visible on page 1.
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary
->id() . '/overview');
$this->assertSession()
->responseMatches('|<nav class="pager" [^>]*>|');
// Ensure that pager is visible on page 2.
$this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary
->id() . '/overview', [
'query' => [
'page' => 1,
],
]);
$this->assertSession()
->responseMatches('|<nav class="pager" [^>]*>|');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.