protected function StateTransitionValidationTest::setupStateStorage in Workbench Moderation 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/StateTransitionValidationTest.php \Drupal\Tests\workbench_moderation\Unit\StateTransitionValidationTest::setupStateStorage()
Builds a mock storage object for States.
Return value
\Drupal\Core\Entity\EntityStorageInterface Returns an entity storage config.
1 call to StateTransitionValidationTest::setupStateStorage()
- StateTransitionValidationTest::setupEntityTypeManager in tests/
src/ Unit/ StateTransitionValidationTest.php - Builds a mocked Entity Type Manager.
File
- tests/
src/ Unit/ StateTransitionValidationTest.php, line 104
Class
- StateTransitionValidationTest
- @coversDefaultClass \Drupal\workbench_moderation\StateTransitionValidation @group workbench_moderation
Namespace
Drupal\Tests\workbench_moderation\UnitCode
protected function setupStateStorage() {
$entity_storage = $this
->prophesize(EntityStorageInterface::class);
$state = $this
->prophesize(ModerationStateInterface::class);
$state
->id()
->willReturn('draft');
$state
->label()
->willReturn('Draft');
$state
->isPublishedState()
->willReturn(FALSE);
$state
->isDefaultRevisionState()
->willReturn(FALSE);
$states['draft'] = $state
->reveal();
$state = $this
->prophesize(ModerationStateInterface::class);
$state
->id()
->willReturn('needs_review');
$state
->label()
->willReturn('Needs Review');
$state
->isPublishedState()
->willReturn(FALSE);
$state
->isDefaultRevisionState()
->willReturn(FALSE);
$states['needs_review'] = $state
->reveal();
$state = $this
->prophesize(ModerationStateInterface::class);
$state
->id()
->willReturn('published');
$state
->label()
->willReturn('Published');
$state
->isPublishedState()
->willReturn(TRUE);
$state
->isDefaultRevisionState()
->willReturn(TRUE);
$states['published'] = $state
->reveal();
$entity_storage
->loadMultiple()
->willReturn($states);
return $entity_storage
->reveal();
}