You are here

public function ModerationContext::assertCurrentModerationState in Lightning Workflow 8.3

Asserts that the "Tasks" toolbar link indicates a moderation state.

@Then the current moderation state should be :state

Parameters

string $state: The label of the expected moderation state.

Throws

\Behat\Mink\Exception\ExpectationException If the current moderation state is not the expected one.

File

tests/contexts/ModerationContext.behat.inc, line 67

Class

ModerationContext
Contains miscellaneous step definitions for testing moderation UIs.

Namespace

Acquia\LightningExtension\Context

Code

public function assertCurrentModerationState($state) {
  $assert_session = $this
    ->assertSession();
  $toolbar = $assert_session
    ->elementExists('css', '#toolbar-bar');
  $current_state = $assert_session
    ->elementExists('named', [
    'link',
    'Tasks',
  ], $toolbar)
    ->getAttribute('data-label');
  if ($current_state !== $state) {
    throw new ExpectationException("Expected the current moderation state to be {$state}, but it is {$current_state}.", $this
      ->getSession()
      ->getDriver());
  }
}