Mercurial > hg > isophonics-drupal-site
comparison core/modules/views/tests/src/Functional/GlossaryTest.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Tests\views\Functional; | 3 namespace Drupal\Tests\views\Functional; |
4 | 4 |
5 use Drupal\Component\Utility\Unicode; | |
6 use Drupal\Core\Language\LanguageInterface; | 5 use Drupal\Core\Language\LanguageInterface; |
7 use Drupal\Core\Url; | 6 use Drupal\Core\Url; |
8 use Drupal\views\Tests\AssertViewsCacheTagsTrait; | 7 use Drupal\views\Tests\AssertViewsCacheTagsTrait; |
9 use Drupal\views\Views; | 8 use Drupal\views\Views; |
10 | 9 |
39 'l' => 6, | 38 'l' => 6, |
40 ]; | 39 ]; |
41 $nodes_by_char = []; | 40 $nodes_by_char = []; |
42 foreach ($nodes_per_char as $char => $count) { | 41 foreach ($nodes_per_char as $char => $count) { |
43 $setting = [ | 42 $setting = [ |
44 'type' => $type->id() | 43 'type' => $type->id(), |
45 ]; | 44 ]; |
46 for ($i = 0; $i < $count; $i++) { | 45 for ($i = 0; $i < $count; $i++) { |
47 $node = $setting; | 46 $node = $setting; |
48 $node['title'] = $char . $this->randomString(3); | 47 $node['title'] = $char . $this->randomString(3); |
49 $node = $this->drupalCreateNode($node); | 48 $node = $this->drupalCreateNode($node); |
107 // Check the actual page response. | 106 // Check the actual page response. |
108 $this->drupalGet($url); | 107 $this->drupalGet($url); |
109 $this->assertResponse(200); | 108 $this->assertResponse(200); |
110 foreach ($nodes_per_char as $char => $count) { | 109 foreach ($nodes_per_char as $char => $count) { |
111 $href = Url::fromRoute('view.glossary.page_1', ['arg_0' => $char])->toString(); | 110 $href = Url::fromRoute('view.glossary.page_1', ['arg_0' => $char])->toString(); |
112 $label = Unicode::strtoupper($char); | 111 $label = mb_strtoupper($char); |
113 // Get the summary link for a certain character. Filter by label and href | 112 // Get the summary link for a certain character. Filter by label and href |
114 // to ensure that both of them are correct. | 113 // to ensure that both of them are correct. |
115 $result = $this->xpath('//a[contains(@href, :href) and normalize-space(text())=:label]/..', [':href' => $href, ':label' => $label]); | 114 $result = $this->xpath('//a[contains(@href, :href) and normalize-space(text())=:label]/..', [':href' => $href, ':label' => $label]); |
116 $this->assertTrue(count($result)); | 115 $this->assertTrue(count($result)); |
117 // The rendered output looks like "<a href=''>X</a> | (count)" so let's | 116 // The rendered output looks like "<a href=''>X</a> | (count)" so let's |