You are here

protected function MigrateMediaTestBase::assertPageTitle in Media Migration 8

Pass if the page HTML title is the given string.

Parameters

string $expected_title: The string the page title should be.

Throws

\Behat\Mink\Exception\ExpectationException Thrown when element doesn't exist, or the title is a different one.

2 calls to MigrateMediaTestBase::assertPageTitle()
MigrateEmbedMediaTokenTestBase::assertMediaTokenTransform in tests/src/Functional/MigrateEmbedMediaTokenTestBase.php
Asserts the result of Media Migration's embed media token transform.
MigrateMediaTest::testMediaMigrate in tests/src/Functional/MigrateMediaTest.php
Tests the result of the media migration.

File

tests/src/Functional/MigrateMediaTestBase.php, line 548

Class

MigrateMediaTestBase
Provides a base class for testing media migration via the UI.

Namespace

Drupal\Tests\media_migration\Functional

Code

protected function assertPageTitle($expected_title) {
  $page_title_element = $this
    ->getSession()
    ->getPage()
    ->find('css', 'h1.page-title');
  if (!$page_title_element) {
    throw new ExpectationException('No page title element found on the page', $this
      ->getSession()
      ->getDriver());
  }
  $actual_title = $page_title_element
    ->getText();
  $this
    ->assertSame($expected_title, $actual_title, 'The page title is not the same as expected.');
}