public function CkEditorContext::execute in Lightning Core 8.3
Same name and namespace in other branches
- 8.5 tests/contexts/CkEditorContext.behat.inc \Acquia\LightningExtension\Context\CkEditorContext::execute()
- 8 tests/contexts/CkEditorContext.behat.inc \Acquia\LightningExtension\Context\CkEditorContext::execute()
- 8.2 tests/contexts/CkEditorContext.behat.inc \Acquia\LightningExtension\Context\CkEditorContext::execute()
- 8.4 tests/contexts/CkEditorContext.behat.inc \Acquia\LightningExtension\Context\CkEditorContext::execute()
Executes a CKEditor command.
@When I execute the :command command in CKEditor @When I execute the :command command in CKEditor :id
Parameters
string $command: The command ID, as known to CKEditor's API.
string $id: (optional) The editor instance ID.
mixed $data: Additional data to pass to the executed command.
Throws
\Behat\Mink\Exception\ExpectationException If the command cannot be executed (i.e., returns a falsy value).
File
- tests/
contexts/ CkEditorContext.behat.inc, line 138
Class
- CkEditorContext
- Contains step definitions for working with CKEditor instances.
Namespace
Acquia\LightningExtension\ContextCode
public function execute($command, $id = NULL, $data = NULL) {
$js = $this
->assertEditor($id);
$session = $this
->getSession();
$return = Json::decode($session
->evaluateScript("{$js}.execCommand('{$command}', " . Json::encode($data) . ')'));
if (empty($return)) {
throw new ExpectationException('CKEditor command ' . $command . ' returned ' . var_export($return, TRUE) . ', expected truthy.', $session
->getDriver());
}
}