You are here

public function MediaBrowserContext::setUp in Lightning Media 8.3

Same name and namespace in other branches
  1. 8.2 tests/contexts/MediaBrowserContext.behat.inc \Acquia\LightningExtension\Context\MediaBrowserContext::setUp()

Performs pre-scenario tasks.

@BeforeScenario

File

tests/contexts/MediaBrowserContext.behat.inc, line 35

Class

MediaBrowserContext
Contains step definitions for interacting with Lightning's media browser.

Namespace

Acquia\LightningExtension\Context

Code

public function setUp(ScenarioScope $scope) {

  // Set the MinkContext's files_path parameter so that the "I attach the file
  // :file to :field"'s :file parameter can be given relative to the test
  // files' directory.
  $mink_context = $this
    ->getContext(MinkContext::class);
  if ($mink_context instanceof MinkContext) {
    $path = $mink_context
      ->getMinkParameter('files_path');
    if (empty($path)) {
      $mink_context
        ->setMinkParameter('files_path', __DIR__ . '/../files');
    }
  }

  // Check if the feature or scenario has the 'javascript' tag.
  $tags = array_merge($scope
    ->getScenario()
    ->getTags(), $scope
    ->getFeature()
    ->getTags());
  $this->isJS = in_array('javascript', $tags, TRUE);
}