You are here

public function SocialMinkContext::iSetAlias in Open Social 8.7

Same name and namespace in other branches
  1. 8.9 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::iSetAlias()
  2. 8.6 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::iSetAlias()
  3. 8.8 tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::iSetAlias()
  4. 10.3.x tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::iSetAlias()
  5. 10.0.x tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::iSetAlias()
  6. 10.1.x tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::iSetAlias()
  7. 10.2.x tests/behat/features/bootstrap/SocialMinkContext.php \Drupal\social\Behat\SocialMinkContext::iSetAlias()

Set alias field as specified value Example: When I set alias as: "bwayne"

@When /^(?:|I )set alias as "(?P<value>(?:[^"]|\\")*)"$/

File

tests/behat/features/bootstrap/SocialMinkContext.php, line 201

Class

SocialMinkContext
Defines application features from the specific context.

Namespace

Drupal\social\Behat

Code

public function iSetAlias($value) {

  // Uncheck "Generate automatic URL alias" if social_path_manager is enabled.
  if (\Drupal::service('module_handler')
    ->moduleExists('social_path_manager')) {
    $option = $this
      ->fixStepArgument('Generate automatic URL alias');
    $this
      ->getSession()
      ->getPage()
      ->uncheckField($option);
  }

  // Fill in "URL alias" field with given value
  $field = $this
    ->fixStepArgument('URL alias');
  $value = $this
    ->fixStepArgument($value);
  $this
    ->getSession()
    ->getPage()
    ->fillField($field, $value);
}