Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/search/tests/src/Functional/SearchNodeDiacriticsTest.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children | a9cd425dd02b |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\Tests\search\Functional; | |
4 | |
5 /** | |
6 * Tests search functionality with diacritics. | |
7 * | |
8 * @group search | |
9 */ | |
10 class SearchNodeDiacriticsTest extends SearchTestBase { | |
11 | |
12 /** | |
13 * A user with permission to use advanced search. | |
14 * | |
15 * @var \Drupal\user\UserInterface | |
16 */ | |
17 public $testUser; | |
18 | |
19 protected function setUp() { | |
20 parent::setUp(); | |
21 node_access_rebuild(); | |
22 | |
23 // Create a test user and log in. | |
24 $this->testUser = $this->drupalCreateUser(['access content', 'search content', 'use advanced search', 'access user profiles']); | |
25 $this->drupalLogin($this->testUser); | |
26 } | |
27 | |
28 /** | |
29 * Tests that search returns results with diacritics in the search phrase. | |
30 */ | |
31 public function testPhraseSearchPunctuation() { | |
32 $body_text = 'The Enricþment Center is cómmīŦŧęđ to the well BɆĬŇĜ of æll påŔťıçȉpǎǹţș. '; | |
33 $body_text .= 'Also meklēt (see #731298)'; | |
34 $this->drupalCreateNode(['body' => [['value' => $body_text]]]); | |
35 | |
36 // Update the search index. | |
37 $this->container->get('plugin.manager.search')->createInstance('node_search')->updateIndex(); | |
38 search_update_totals(); | |
39 | |
40 // Refresh variables after the treatment. | |
41 $this->refreshVariables(); | |
42 | |
43 $edit = ['keys' => 'meklet']; | |
44 $this->drupalPostForm('search/node', $edit, t('Search')); | |
45 $this->assertRaw('<strong>meklēt</strong>'); | |
46 | |
47 $edit = ['keys' => 'meklēt']; | |
48 $this->drupalPostForm('search/node', $edit, t('Search')); | |
49 $this->assertRaw('<strong>meklēt</strong>'); | |
50 | |
51 $edit = ['keys' => 'cómmīŦŧęđ BɆĬŇĜ påŔťıçȉpǎǹţș']; | |
52 $this->drupalPostForm('search/node', $edit, t('Search')); | |
53 $this->assertRaw('<strong>cómmīŦŧęđ</strong>'); | |
54 $this->assertRaw('<strong>BɆĬŇĜ</strong>'); | |
55 $this->assertRaw('<strong>påŔťıçȉpǎǹţș</strong>'); | |
56 | |
57 $edit = ['keys' => 'committed being participants']; | |
58 $this->drupalPostForm('search/node', $edit, t('Search')); | |
59 $this->assertRaw('<strong>cómmīŦŧęđ</strong>'); | |
60 $this->assertRaw('<strong>BɆĬŇĜ</strong>'); | |
61 $this->assertRaw('<strong>påŔťıçȉpǎǹţș</strong>'); | |
62 | |
63 $edit = ['keys' => 'Enricþment']; | |
64 $this->drupalPostForm('search/node', $edit, t('Search')); | |
65 $this->assertRaw('<strong>Enricþment</strong>'); | |
66 | |
67 $edit = ['keys' => 'Enritchment']; | |
68 $this->drupalPostForm('search/node', $edit, t('Search')); | |
69 $this->assertNoRaw('<strong>Enricþment</strong>'); | |
70 | |
71 $edit = ['keys' => 'æll']; | |
72 $this->drupalPostForm('search/node', $edit, t('Search')); | |
73 $this->assertRaw('<strong>æll</strong>'); | |
74 | |
75 $edit = ['keys' => 'all']; | |
76 $this->drupalPostForm('search/node', $edit, t('Search')); | |
77 $this->assertNoRaw('<strong>æll</strong>'); | |
78 } | |
79 | |
80 } |