3 namespace Drupal\Tests\taxonomy\Functional;
6 * Ensures that the term pager works properly.
10 class TaxonomyTermPagerTest extends TaxonomyTestBase {
17 public static $modules = ['taxonomy'];
20 * Vocabulary for testing.
22 * @var \Drupal\taxonomy\VocabularyInterface
24 protected $vocabulary;
29 protected function setUp() {
31 $this->drupalLogin($this->drupalCreateUser(['administer taxonomy', 'bypass node access']));
32 $this->vocabulary = $this->createVocabulary();
36 * Tests that the pager is displayed properly on the term overview page.
38 public function testTaxonomyTermOverviewPager() {
39 // Set limit to 3 terms per page.
40 $this->config('taxonomy.settings')
41 ->set('terms_per_page_admin', '3')
45 for ($x = 1; $x <= 3; $x++) {
46 $this->createTerm($this->vocabulary);
50 $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
51 $this->assertNoPattern('|<nav class="pager" [^>]*>|', 'Pager is not visible on page 1');
53 // Create 3 more terms to show pager.
54 for ($x = 1; $x <= 3; $x++) {
55 $this->createTerm($this->vocabulary);
59 $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
60 $this->assertPattern('|<nav class="pager" [^>]*>|', 'Pager is visible on page 1');
63 $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview', ['query' => ['page' => 1]]);
64 $this->assertPattern('|<nav class="pager" [^>]*>|', 'Pager is visible on page 2');