TaxonomyTermPagerTest.php in Drupal 10
File
core/modules/taxonomy/tests/src/Functional/TaxonomyTermPagerTest.php
View source
<?php
namespace Drupal\Tests\taxonomy\Functional;
class TaxonomyTermPagerTest extends TaxonomyTestBase {
protected static $modules = [
'taxonomy',
];
protected $defaultTheme = 'stark';
protected $vocabulary;
protected function setUp() : void {
parent::setUp();
$this
->drupalLogin($this
->drupalCreateUser([
'administer taxonomy',
'bypass node access',
]));
$this->vocabulary = $this
->createVocabulary();
}
public function testTaxonomyTermOverviewPager() {
$this
->config('taxonomy.settings')
->set('terms_per_page_admin', '3')
->save();
for ($x = 1; $x <= 3; $x++) {
$this
->createTerm($this->vocabulary);
}
$this
->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary
->id() . '/overview');
$this
->assertSession()
->responseNotMatches('|<nav class="pager" [^>]*>|');
for ($x = 1; $x <= 3; $x++) {
$this
->createTerm($this->vocabulary);
}
$this
->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary
->id() . '/overview');
$this
->assertSession()
->responseMatches('|<nav class="pager" [^>]*>|');
$this
->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary
->id() . '/overview', [
'query' => [
'page' => 1,
],
]);
$this
->assertSession()
->responseMatches('|<nav class="pager" [^>]*>|');
}
}