public function FeatureContext::imagePathInBodyDescriptionShouldBePrivate in Open Social 8.4
Same name and namespace in other branches
- 8.9 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::imagePathInBodyDescriptionShouldBePrivate()
- 8.3 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::imagePathInBodyDescriptionShouldBePrivate()
- 8.5 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::imagePathInBodyDescriptionShouldBePrivate()
- 8.6 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::imagePathInBodyDescriptionShouldBePrivate()
- 8.7 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::imagePathInBodyDescriptionShouldBePrivate()
- 8.8 tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::imagePathInBodyDescriptionShouldBePrivate()
- 10.3.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::imagePathInBodyDescriptionShouldBePrivate()
- 10.0.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::imagePathInBodyDescriptionShouldBePrivate()
- 10.1.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::imagePathInBodyDescriptionShouldBePrivate()
- 10.2.x tests/behat/features/bootstrap/FeatureContext.php \Drupal\social\Behat\FeatureContext::imagePathInBodyDescriptionShouldBePrivate()
@Then /^The image path in the body description should be private$/
File
- tests/
behat/ features/ bootstrap/ FeatureContext.php, line 166
Class
- FeatureContext
- Defines application features from the specific context.
Namespace
Drupal\social\BehatCode
public function imagePathInBodyDescriptionShouldBePrivate() {
$cssSelector = 'article .card__body .body-text img';
$session = $this
->getSession();
$element = $session
->getPage()
->find('xpath', $session
->getSelectorsHandler()
->selectorToXpath('css', $cssSelector));
if (null === $element) {
throw new \InvalidArgumentException(sprintf('Could not evaluate CSS Selector: "%s"', $cssSelector));
}
$src = $element
->getAttribute('src');
if (strpos($src, '/system/files/inline-images') === FALSE) {
throw new \InvalidArgumentException(sprintf('The image does not seem to be uploaded in the private file system: "%s"', $src));
}
}