You are here

public function CkEditorContext::assertEditorMatch in Lightning Core 8.2

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

Assert that a CKEditor's content matches a regular expression.

@Then CKEditor should match :expression @Then CKEditor :id should match :expression

Parameters

string $expr: The regular expression to match.

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

Throws

ExpectationException If the expression does not match.

File

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

Class

CkEditorContext
Contains step definitions for working with CKEditor instances.

Namespace

Acquia\LightningExtension\Context

Code

public function assertEditorMatch($expr, $id = NULL) {
  $match = preg_match($expr, $this
    ->getContent($id));
  if ($match == 0) {
    throw new ExpectationException('Expected CKEditor ' . $id . ' to match "' . $expr . '".', $this
      ->getSession()
      ->getDriver());
  }
}