comparison core/modules/contextual/tests/src/FunctionalJavascript/ContextualLinksTest.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents 1fec387a4317
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
1 <?php 1 <?php
2 2
3 namespace Drupal\Tests\contextual\FunctionalJavascript; 3 namespace Drupal\Tests\contextual\FunctionalJavascript;
4 4
5 use Drupal\FunctionalJavascriptTests\JavascriptTestBase; 5 use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
6 use Drupal\user\Entity\Role; 6 use Drupal\user\Entity\Role;
7 7
8 /** 8 /**
9 * Tests the UI for correct contextual links. 9 * Tests the UI for correct contextual links.
10 * 10 *
11 * @group contextual 11 * @group contextual
12 */ 12 */
13 class ContextualLinksTest extends JavascriptTestBase { 13 class ContextualLinksTest extends WebDriverTestBase {
14 14
15 use ContextualLinkClickTrait; 15 use ContextualLinkClickTrait;
16 16
17 /** 17 /**
18 * {@inheritdoc} 18 * {@inheritdoc}
90 $this->getSession()->getPage()->find('css', '.contextual-toolbar-tab button')->press(); 90 $this->getSession()->getPage()->find('css', '.contextual-toolbar-tab button')->press();
91 $this->clickContextualLink('#block-branding', 'Test Link', FALSE); 91 $this->clickContextualLink('#block-branding', 'Test Link', FALSE);
92 $this->assertSession()->pageTextContains('Everything is contextual!'); 92 $this->assertSession()->pageTextContains('Everything is contextual!');
93 } 93 }
94 94
95 /**
96 * Test the contextual links destination.
97 */
98 public function testContextualLinksDestination() {
99 $this->grantPermissions(Role::load(Role::AUTHENTICATED_ID), [
100 'access contextual links',
101 'administer blocks',
102 ]);
103 $this->drupalGet('user');
104 $this->assertSession()->waitForElement('css', '.contextual button');
105 $expected_destination_value = (string) $this->loggedInUser->toUrl()->toString();
106 $contextual_link_url_parsed = parse_url($this->getSession()->getPage()->findLink('Configure block')->getAttribute('href'));
107 $this->assertEquals("destination=$expected_destination_value", $contextual_link_url_parsed['query']);
108 }
109
95 } 110 }