You are here

public function CkEditorContext::assertEditorContains in Lightning Core 8.4

Same name and namespace in other branches
  1. 8.5 tests/contexts/CkEditorContext.behat.inc \Acquia\LightningExtension\Context\CkEditorContext::assertEditorContains()
  2. 8 tests/contexts/CkEditorContext.behat.inc \Acquia\LightningExtension\Context\CkEditorContext::assertEditorContains()
  3. 8.2 tests/contexts/CkEditorContext.behat.inc \Acquia\LightningExtension\Context\CkEditorContext::assertEditorContains()
  4. 8.3 tests/contexts/CkEditorContext.behat.inc \Acquia\LightningExtension\Context\CkEditorContext::assertEditorContains()

Asserts that a CKEditor's content contains a snippet of text.

@Then CKEditor should contain :text @Then CKEditor :id should contain :text

Parameters

string $text: The text (or HTML) snippet to look for.

string $id: (optional) The editor instance ID.

Throws

\Behat\Mink\Exception\ExpectationException If the editor does not contain the specified text.

File

tests/contexts/CkEditorContext.behat.inc, line 72

Class

CkEditorContext
Contains step definitions for working with CKEditor instances.

Namespace

Acquia\LightningExtension\Context

Code

public function assertEditorContains($text, $id = NULL) {
  $position = strpos($this
    ->getContent($id), $text);
  if ($position == FALSE) {
    throw new ExpectationException('Expected CKEditor ' . $id . ' to contain "' . $text . '".', $this
      ->getSession()
      ->getDriver());
  }
}