summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorxjm2015-04-26 21:15:07 (GMT)
committerxjm2015-04-26 21:15:07 (GMT)
commit73cf5bd62a97fd56bae581ee94468d6f241479f8 (patch)
tree0feffacec31398e9779c1fc2f2a04804383a30db
parenta6274c0f4781274961bbf03ac3cadbf028bb5dc8 (diff)
Issue #2425535 by lucaslg, balagan, tim.plunkett, lucaschain, nicoloye, pjonckiere, akalata, mondrake: No pager shows on taxonomy overview pages
-rw-r--r--core/modules/taxonomy/src/Form/OverviewTerms.php1
-rw-r--r--core/modules/taxonomy/src/Tests/TaxonomyTermPagerTest.php72
2 files changed, 73 insertions, 0 deletions
diff --git a/core/modules/taxonomy/src/Form/OverviewTerms.php b/core/modules/taxonomy/src/Form/OverviewTerms.php
index eebbacc..d7d54ed 100644
--- a/core/modules/taxonomy/src/Form/OverviewTerms.php
+++ b/core/modules/taxonomy/src/Form/OverviewTerms.php
@@ -358,6 +358,7 @@ class OverviewTerms extends FormBase {
);
}
+ $form['pager_pager'] = ['#type' => 'pager'];
return $form;
}
diff --git a/core/modules/taxonomy/src/Tests/TaxonomyTermPagerTest.php b/core/modules/taxonomy/src/Tests/TaxonomyTermPagerTest.php
new file mode 100644
index 0000000..515d4dbe
--- /dev/null
+++ b/core/modules/taxonomy/src/Tests/TaxonomyTermPagerTest.php
@@ -0,0 +1,72 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\taxonomy\Tests\TaxonomyTermPagerTest.
+ */
+
+namespace Drupal\taxonomy\Tests;
+
+/**
+ * Ensures that the term pager works properly.
+ *
+ * @group taxonomy
+ */
+class TaxonomyTermPagerTest extends TaxonomyTestBase {
+
+ /**
+ * Modules to enable.
+ *
+ * @var array
+ */
+ public static $modules = ['taxonomy'];
+
+ /**
+ * Vocabulary for testing.
+ *
+ * @var \Drupal\taxonomy\VocabularyInterface
+ */
+ protected $vocabulary;
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function setUp() {
+ 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');
+ $this->assertNoPattern('|<nav class="pager" [^>]*>|', 'Pager is not visible on page 1');
+
+ // Create 3 more terms to show pager.
+ for ($x = 1; $x <= 3; $x++) {
+ $this->createTerm($this->vocabulary);
+ }
+
+ // Get Page 1.
+ $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview');
+ $this->assertPattern('|<nav class="pager" [^>]*>|', 'Pager is visible on page 1');
+
+ // Get Page 2.
+ $this->drupalGet('admin/structure/taxonomy/manage/' . $this->vocabulary->id() . '/overview', ['query' => ['page' => 1]]);
+ $this->assertPattern('|<nav class="pager" [^>]*>|', 'Pager is visible on page 2');
+ }
+
+}