Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/search/tests/src/Functional/SearchBlockTest.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
comparison
equal
deleted
inserted
replaced
4:a9cd425dd02b | 5:12f9dff5fda9 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Tests\search\Functional; | 3 namespace Drupal\Tests\search\Functional; |
4 | 4 |
5 use Drupal\Core\Url; | |
5 use Drupal\Tests\BrowserTestBase; | 6 use Drupal\Tests\BrowserTestBase; |
6 | 7 |
7 /** | 8 /** |
8 * Tests if the search form block is available. | 9 * Tests if the search form block is available. |
9 * | 10 * |
70 /** @var $search_page_repository \Drupal\search\SearchPageRepositoryInterface */ | 71 /** @var $search_page_repository \Drupal\search\SearchPageRepositoryInterface */ |
71 $search_page_repository = \Drupal::service('search.search_page_repository'); | 72 $search_page_repository = \Drupal::service('search.search_page_repository'); |
72 $entity_id = $search_page_repository->getDefaultSearchPage(); | 73 $entity_id = $search_page_repository->getDefaultSearchPage(); |
73 $this->assertEqual( | 74 $this->assertEqual( |
74 $this->getUrl(), | 75 $this->getUrl(), |
75 \Drupal::url('search.view_' . $entity_id, [], ['query' => ['keys' => $terms['keys']], 'absolute' => TRUE]), | 76 Url::fromRoute('search.view_' . $entity_id, [], ['query' => ['keys' => $terms['keys']], 'absolute' => TRUE])->toString(), |
76 'Submitted to correct URL.' | 77 'Submitted to correct URL.' |
77 ); | 78 ); |
78 | 79 |
79 // Test an empty search via the block form, from the front page. | 80 // Test an empty search via the block form, from the front page. |
80 $terms = ['keys' => '']; | 81 $terms = ['keys' => '']; |
84 | 85 |
85 // Confirm that the user is redirected to the search page, when form is | 86 // Confirm that the user is redirected to the search page, when form is |
86 // submitted empty. | 87 // submitted empty. |
87 $this->assertEqual( | 88 $this->assertEqual( |
88 $this->getUrl(), | 89 $this->getUrl(), |
89 \Drupal::url('search.view_' . $entity_id, [], ['query' => ['keys' => ''], 'absolute' => TRUE]), | 90 Url::fromRoute('search.view_' . $entity_id, [], ['query' => ['keys' => ''], 'absolute' => TRUE])->toString(), |
90 'Redirected to correct URL.' | 91 'Redirected to correct URL.' |
91 ); | 92 ); |
92 | 93 |
93 // Test that after entering a too-short keyword in the form, you can then | 94 // Test that after entering a too-short keyword in the form, you can then |
94 // search again with a longer keyword. First test using the block form. | 95 // search again with a longer keyword. First test using the block form. |