public function LiftLinkTest::testLinkInToolbarAfterConfigChange in Acquia Lift Connector 8.3
File
- src/
Tests/ LiftLinkTest.php, line 67
Class
- LiftLinkTest
- Test Acquia Lift Toolbar Link.
Namespace
Drupal\acquia_lift\TestsCode
public function testLinkInToolbarAfterConfigChange() {
$permissions = [
'access toolbar',
'access acquia lift links',
];
// User to set up acquia_lift.
$linkUser = $this
->drupalCreateUser($permissions);
$this
->drupalLogin($linkUser);
// Check if Acquia Lift Link is available on the node that we created
$node = $this
->drupalCreateNode();
// Assert that the Acquia Lift link ID is not present in the HTML.
$this
->drupalGet($node
->toUrl());
$this
->assertNoRaw('id="openLiftLink"');
// These contexts should be set.
$this
->assertCacheContext('url.path');
$this
->assertCacheContext('user');
// These tags should be set.
$this
->assertCacheTag('config:acquia_lift.settings');
// Set valid settings
$this
->setValidSettings();
// Assert that the Acquia Lift link ID is present in the HTML.
// This also verifies if the specific render cache is cleared.
$this
->drupalGet($node
->toUrl());
$this
->assertRaw('id="openLiftLink"');
// These tags should be set.
$this
->assertCacheTag('config:acquia_lift.settings');
// These contexts should be set.
$this
->assertCacheContext('url.path');
$this
->assertCacheContext('user');
$this
->assertCacheContext('url.query_args:_wrapper_format');
$this
->assertCacheContext('url.query_args:my_identity_parameter');
$this
->assertCacheContext('url.query_args:my_identity_type_parameter');
}