diff --git a/core/modules/views/config/views.view.glossary.yml b/core/modules/views/config/views.view.glossary.yml index 8237f1f..c035a6e 100644 --- a/core/modules/views/config/views.view.glossary.yml +++ b/core/modules/views/config/views.view.glossary.yml @@ -361,7 +361,7 @@ display: break_phrase: '0' displays: default: default - page: page_1 + page_1: page_1 inherit_arguments: '0' label: Glossary module: node diff --git a/core/modules/views/lib/Drupal/views/Tests/GlossaryTest.php b/core/modules/views/lib/Drupal/views/Tests/GlossaryTest.php index ad0dfe3..c721627 100644 --- a/core/modules/views/lib/Drupal/views/Tests/GlossaryTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/GlossaryTest.php @@ -6,17 +6,25 @@ */ namespace Drupal\views\Tests; +use Drupal\Component\Utility\Unicode; /** * Tests glossary view ( summary of arguments ). */ class GlossaryTest extends ViewTestBase { + /** + * Modules to enable. + * + * @var array + */ + public static $modules = array('node'); + public static function getInfo() { return array( 'name' => 'Glossary tests', 'description' => 'Tests glossary functionality of views.', - 'group' => 'Views', + 'group' => 'Views Config', ); } @@ -55,6 +63,27 @@ public function testGlossaryView() { foreach ($view->result as $item) { $this->assertEqual($nodes_per_char[$item->title_truncated], $item->num_records); } + + // Enable the glossary to be displayed. + $view->storage->enable()->save(); + // Check the actual page response. + $this->drupalGet('glossary'); + $this->assertResponse(200); + + foreach ($nodes_per_char as $char => $count) { + $href = url('glossary/' . $char); + $label = Unicode::strtoupper($char); + // Get the summary link for a certain character. Filter by label and href + // to ensure that both of them are correct. + $result = $this->xpath('//a[contains(@href, :href) and normalize-space(text())=:label]/..', array(':href' => $href, ':label' => $label)); + $this->assertTrue(count($result)); + // The rendered output looks like "| (count)" so let's figure out the int. + debug((string) $result[0]); + debug(trim(str_replace(array('|', '(', ')'), '', (string) $result[0]))); + debug($count); + $result_count = trim(str_replace(array('|', '(', ')'), '', (string) $result[0])); + $this->assertEqual($result_count, $count, 'The expected number got rendered.'); + } } }