You are here

public function LogActionsTest::testMarkAsPendingAction in Log entity 2.x

Tests that the mark as pending action sets the right state.

File

tests/src/Kernel/LogActionsTest.php, line 86

Class

LogActionsTest
Tests for log actions.

Namespace

Drupal\Tests\log\Kernel

Code

public function testMarkAsPendingAction() {
  $action = $this->actionManager
    ->createInstance('log_mark_as_pending_action');
  $this
    ->assertTrue($action instanceof ActionInterface, 'The action implements the correct interface.');
  $new_log = $this
    ->createLogEntity([
    'name' => $this
      ->randomMachineName(),
    'status' => 'done',
  ]);
  $new_log
    ->save();
  $action
    ->execute($new_log);
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('log');
  $log = $storage
    ->load($new_log
    ->id());
  $this
    ->assertEqual($log
    ->get('status')->value, 'pending');
}