X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcontent_moderation%2Ftests%2Fsrc%2FUnit%2FStateTransitionValidationTest.php;h=b60e0454c01bbb12dfeb87a099a58313ab407d67;hp=2e034477878e81e3377636193f037cdd65b8ba7e;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php b/web/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php index 2e0344778..b60e0454c 100644 --- a/web/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php +++ b/web/core/modules/content_moderation/tests/src/Unit/StateTransitionValidationTest.php @@ -7,8 +7,9 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Session\AccountInterface; use Drupal\content_moderation\StateTransitionValidation; +use Drupal\Tests\UnitTestCase; +use Drupal\workflow_type_test\Plugin\WorkflowType\TestType; use Drupal\workflows\Entity\Workflow; -use Drupal\workflows\WorkflowTypeInterface; use Drupal\workflows\WorkflowTypeManager; use Prophecy\Argument; @@ -16,7 +17,7 @@ use Prophecy\Argument; * @coversDefaultClass \Drupal\content_moderation\StateTransitionValidation * @group content_moderation */ -class StateTransitionValidationTest extends \PHPUnit_Framework_TestCase { +class StateTransitionValidationTest extends UnitTestCase { /** * Verifies user-aware transition validation. @@ -61,16 +62,14 @@ class StateTransitionValidationTest extends \PHPUnit_Framework_TestCase { // Create a container so that the plugin manager and workflow type can be // mocked. $container = new ContainerBuilder(); - $workflow_type = $this->prophesize(WorkflowTypeInterface::class); - $workflow_type->decorateState(Argument::any())->willReturnArgument(0); - $workflow_type->decorateTransition(Argument::any())->willReturnArgument(0); $workflow_manager = $this->prophesize(WorkflowTypeManager::class); - $workflow_manager->createInstance('content_moderation', Argument::any())->willReturn($workflow_type->reveal()); + $workflow_manager->createInstance('content_moderation', Argument::any())->willReturn(new TestType([], '', [])); $container->set('plugin.manager.workflows.type', $workflow_manager->reveal()); \Drupal::setContainer($container); $workflow = new Workflow(['id' => 'process', 'type' => 'content_moderation'], 'workflow'); $workflow + ->getTypePlugin() ->addState('draft', 'draft') ->addState('needs_review', 'needs_review') ->addState('published', 'published')