public function FeatureContext::openEntityAndExpectAccess in Open Social 8.4
Same name and namespace in other branches
- 8.9 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::openEntityAndExpectAccess()
- 8.3 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::openEntityAndExpectAccess()
- 8.5 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::openEntityAndExpectAccess()
- 8.6 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::openEntityAndExpectAccess()
- 8.7 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::openEntityAndExpectAccess()
- 8.8 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::openEntityAndExpectAccess()
- 10.3.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::openEntityAndExpectAccess()
- 10.0.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::openEntityAndExpectAccess()
- 10.1.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::openEntityAndExpectAccess()
- 10.2.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::openEntityAndExpectAccess()
This opens the entity and check for the expected access.
Parameters
$entity_type:
$entity_id:
$expected_access: 0 = NO access 1 = YES access
1 call to FeatureContext::openEntityAndExpectAccess()
- FeatureContext::openAndCheckGroupContentAccess in tests/
behat/ features/ bootstrap/ FeatureContext.php - Opens the content from a group and check for access.
File
- tests/
behat/ features/ bootstrap/ FeatureContext.php, line 835
Class
- FeatureContext
- Defines application features from the specific context.
Namespace
Drupal\social\BehatCode
public function openEntityAndExpectAccess($entity_type, $entity_id, $expected_access) {
$entity = entity_load($entity_type, $entity_id);
/** @var \Drupal\Core\Url $url */
$url = $entity
->toUrl();
$page = $url
->toString();
$this
->visitPath($page);
if ($expected_access == 0) {
$this
->assertSession()
->pageTextContains('Access denied');
}
else {
$this
->assertSession()
->pageTextNotContains('Access denied');
}
}