public function LogActionsTest::testMarkAsDoneAction in Log entity 2.x
Tests that the mark as done action sets the right state.
File
- tests/
src/ Kernel/ LogActionsTest.php, line 69
Class
- LogActionsTest
- Tests for log actions.
Namespace
Drupal\Tests\log\KernelCode
public function testMarkAsDoneAction() {
$action = $this->actionManager
->createInstance('log_mark_as_done_action');
$this
->assertTrue($action instanceof ActionInterface, 'The action implements the correct interface.');
$new_log = $this
->createLogEntity([
'name' => $this
->randomMachineName(),
'status' => 'pending',
]);
$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, 'done');
}