You are here

public function MediaEntityContext::assertMediaItemPage in Lightning Media 8.3

Same name and namespace in other branches
  1. 8 tests/contexts/MediaEntityContext.behat.inc \Acquia\LightningExtension\Context\MediaEntityContext::assertMediaItemPage()
  2. 8.2 tests/contexts/MediaEntityContext.behat.inc \Acquia\LightningExtension\Context\MediaEntityContext::assertMediaItemPage()

Asserts that we are visiting a media entity.

@Then I should be visiting a media item

File

tests/contexts/MediaEntityContext.behat.inc, line 56

Class

MediaEntityContext
Contains step definitions for interacting with media entities.

Namespace

Acquia\LightningExtension\Context

Code

public function assertMediaItemPage() {
  $assert = $this
    ->assertSession();

  // The path must start with "/media/" and end with "/ID"; the bundle may be
  // in the middle if Pathauto is installed.
  $assert
    ->addressMatches('#^/media/([\\w-]+/)?\\d+$#');
  try {
    $assert
      ->statusCodeEquals(200);
  } catch (UnsupportedDriverActionException $e) {

    // This isn't a critically important assertion, so don't worry about it.
  }
}