Draft: Issue #3517299: Convert functional tests in help module to kernel tests
4 unresolved threads
4 unresolved threads
Closes #3517299
Merge request reports
Activity
99 116 100 117 // Make sure links are properly added for modules implementing hook_help(). 101 118 foreach ($this->getModuleList() as $module => $name) { 102 $this->assertSession()->linkExists($name, 0, new FormattableMarkup('Link properly added to @name (admin/help/@module)', ['@module' => $module, '@name' => $name])); 119 $this->assertSession()->linkExists($name, 0, new FormattableMarkup('Link properly added to @name (admin/help/@module)', [ 120 '@module' => $module, 121 '@name' => $name, 122 ])); 103 123 } 104 124 105 125 // Ensure a module which does not provide a module overview page is handled 106 126 // correctly. 107 127 $module_name = \Drupal::service('extension.list.module')->getName('help_test'); 108 $this->clickLink($module_name); 128 $link = $this->getSession()->getPage()->find('named', ['link', $module_name]); 129 $this->drupalGet($link->getAttribute('href')); 236 260 237 261 // Verify that the "no test" user, who should not be able to access 238 262 // the 'valid link' URL, sees it as not a link. 239 $this->drupalLogin($this->noTestUser); 240 $this->drupalGet('admin/help/topic/help_topics_test.test_urls'); 263 $this->setCurrentUser($this->noTestUser); 264 $this->drupalGet('/admin/help/topic/help_topics_test.test_urls'); 291 315 'admin/config/system' => 'System', 292 316 ]; 293 $this->assertBreadcrumb('admin/config/system/site-information', $trail); 317 $this->assertBreadcrumb('/admin/config/system/site-information', $trail); 318 } 319 320 /** 321 * Overrides AssertContentTrait for use in Kernel tests. 322 * 323 * @see \Drupal\KernelTests\AssertContentTrait::xpath() 324 * @see \Drupal\Tests\BrowserTestBase::xpath() 325 */ 326 protected function xpath($xpath, array $arguments = []): array { 327 $xpath = $this->assertSession()->buildXPathQuery($xpath, $arguments); 328 return $this->getSession()->getPage()->findAll('xpath', $xpath); 329 } 322 * 323 * @see \Drupal\KernelTests\AssertContentTrait::xpath() 324 * @see \Drupal\Tests\BrowserTestBase::xpath() 325 */ 326 protected function xpath($xpath, array $arguments = []): array { 327 $xpath = $this->assertSession()->buildXPathQuery($xpath, $arguments); 328 return $this->getSession()->getPage()->findAll('xpath', $xpath); 329 } 330 331 /** 332 * Get the current URL from the browser. 333 * 334 * @see \Drupal\Tests\UiHelperTrait::getUrl 335 */ 336 protected function getUrl(): string { 337 return $this->getSession()->getCurrentUrl(); @joachim I added some comments on things we might need to consider for the trait
Please register or sign in to reply