Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
}
],
"require": {
"php": "^7.1.3",
"php": "^8.1.0",
"ext-dom": "*",
"symfony/expression-language": "~3.4|~4.0|~5.0"
"symfony/expression-language": "~3.4|~4.0|~5.0|~6.0"
},
"require-dev": {
"phpunit/phpunit": "~6.5"
"phpunit/phpunit": "~10.0"
},
"autoload": {
"psr-4": {
Expand Down
17 changes: 6 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="phpunit.xsd"
bootstrap="tests/bootstrap.php"
backupGlobals="false"
verbose="true"
colors="true">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" bootstrap="tests/bootstrap.php" backupGlobals="false" colors="true" cacheDirectory=".phpunit.cache">
<coverage/>
<testsuites>
<testsuite name="Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>

<filter>
<whitelist>
<source>
<include>
<directory>./src</directory>
</whitelist>
</filter>
</include>
</source>
</phpunit>
38 changes: 14 additions & 24 deletions tests/Workflow/ProcessInstanceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ProcessInstanceTest extends TestCase
/**
* {@inheritdoc}
*/
protected function setUp()
protected function setUp(): void
{
$this->workflowRepository = new WorkflowRepository();
}
Expand Down Expand Up @@ -153,7 +153,7 @@ public function completeWorkItem()
/**
* @return array
*/
public function completeActivityOnConditionalSequenceFlowsData()
public static function completeActivityOnConditionalSequenceFlowsData()
{
return [
[true, null],
Expand Down Expand Up @@ -196,7 +196,7 @@ public function completeActivityOnConditionalSequenceFlow($rejected, $nextFlowOb
/**
* @return array
*/
public function selectSequenceFlowOnExclusiveGatewayData()
public static function selectSequenceFlowOnExclusiveGatewayData()
{
return [
[true, 'InformRejection'],
Expand Down Expand Up @@ -400,9 +400,7 @@ public function executeServiceTasks()
{
$participant = $this->createMock(ParticipantInterface::class);
$participant->method('hasRole')->willReturn(true);
$operationRunner = $this->getMockBuilder(OperationRunnerInterface::class)
->setMethods(['provideParticipant', 'run'])
->getMock();
$operationRunner = $this->createMock(OperationRunnerInterface::class);
$operationRunner->method('provideParticipant')->willReturn($participant);
$self = $this;
$operationRunner->expects($this->exactly(2))->method('run')->willReturnCallback(function (WorkItemInterface $workItem) use ($self) {
Expand All @@ -428,9 +426,7 @@ public function executeServiceTasks()
*/
public function provideDefaultRoleForWorkflowWithoutLanes()
{
$participant = $this->getMockBuilder(ParticipantInterface::class)
->setMethods(['hasRole', 'setResource', 'getResource', 'getName', 'getId'])
->getMock();
$participant = $this->createMock(ParticipantInterface::class);
$participant->expects($this->exactly(3))->method('hasRole')->with($this->equalTo(ProcessInstance::DEFAULT_ROLE_ID))->willReturn(true);

$workflow = $this->workflowRepository->findById('NoLanesProcess');
Expand All @@ -453,9 +449,7 @@ public function executeSendTasks()
{
$participant = $this->createMock(ParticipantInterface::class);
$participant->method('hasRole')->willReturn(true);
$operationRunner = $this->getMockBuilder(OperationRunnerInterface::class)
->setMethods(['provideParticipant', 'run'])
->getMock();
$operationRunner = $this->createMock(OperationRunnerInterface::class);
$operationRunner->method('provideParticipant')->willReturn($participant);
$self = $this;
$operationRunner->expects($this->exactly(2))->method('run')->willReturnCallback(function (WorkItemInterface $workItem) use ($self) {
Expand Down Expand Up @@ -495,7 +489,7 @@ public function parallelGateway()
$this->assertThat(count($currentFlowObjects), $this->equalTo(count($concurrentFlowObjects)));

foreach ($currentFlowObjects as $currentFlowObject) {
$this->assertThat($concurrentFlowObjects, $this->contains($currentFlowObject->getId()));
$this->assertThat($concurrentFlowObjects, $this->containsEqual($currentFlowObject->getId()));
$this->assertThat(current($currentFlowObject->getToken())->getPreviousFlowObject()->getId(), $this->equalTo('ParallelGateway1'));

unset($concurrentFlowObjects[array_search($currentFlowObject->getId(), $concurrentFlowObjects)]);
Expand Down Expand Up @@ -524,11 +518,11 @@ public function parallelGateway()

$concurrentFlowObjects = ['ReceivePayment', 'ShipOrder'];

$this->assertThat($concurrentFlowObjects, $this->contains($activityLog->get(0)->getActivity()->getId()));
$this->assertThat($concurrentFlowObjects, $this->containsEqual($activityLog->get(0)->getActivity()->getId()));

unset($concurrentFlowObjects[array_search($activityLog->get(0)->getActivity()->getId(), $concurrentFlowObjects)]);

$this->assertThat($concurrentFlowObjects, $this->contains($activityLog->get(1)->getActivity()->getId()));
$this->assertThat($concurrentFlowObjects, $this->containsEqual($activityLog->get(1)->getActivity()->getId()));

$this->assertThat($activityLog->get(2)->getActivity()->getId(), $this->equalTo('ArchiveOrder'));
}
Expand Down Expand Up @@ -723,9 +717,7 @@ public function executeParallelUserTasks()
['test' => 3],
['test' => 4],
];
$dataProvider = $this->getMockBuilder(DataProviderInterface::class)
->setMethods(['getParallelInstancesData', 'getSequentialInstanceData', 'getSingleInstanceData', 'mergeInstancesData'])
->getMock();
$dataProvider = $this->createMock(DataProviderInterface::class);
$dataProvider->method('getParallelInstancesData')->willReturn($parallelData);

$workflow = $this->workflowRepository->findById('ParallelUserTasks');
Expand Down Expand Up @@ -765,9 +757,7 @@ public function executeSequentialUserTasks()
$participant->method('hasRole')->willReturn(true);

$counter = 0;
$dataProvider = $this->getMockBuilder(DataProviderInterface::class)
->setMethods(['getParallelInstancesData', 'getSequentialInstanceData', 'getSingleInstanceData', 'mergeInstancesData'])
->getMock();
$dataProvider = $this->createMock(DataProviderInterface::class);
$dataProvider->method('getSequentialInstanceData')->willReturn(['test' => ++$counter]);

$workflow = $this->workflowRepository->findById('SequentialUserTasks');
Expand Down Expand Up @@ -928,11 +918,11 @@ public function inclusiveGateway()

$concurrentFlowObjects = ['ReceiveOrder', 'ShipOrder'];

$this->assertThat($concurrentFlowObjects, $this->contains($activityLog->get(0)->getActivity()->getId()));
$this->assertThat($concurrentFlowObjects, $this->containsEqual($activityLog->get(0)->getActivity()->getId()));

unset($concurrentFlowObjects[array_search($activityLog->get(0)->getActivity()->getId(), $concurrentFlowObjects)]);

$this->assertThat($concurrentFlowObjects, $this->contains($activityLog->get(1)->getActivity()->getId()));
$this->assertThat($concurrentFlowObjects, $this->containsEqual($activityLog->get(1)->getActivity()->getId()));

$this->assertThat($activityLog->get(2)->getActivity()->getId(), $this->equalTo('ArchiveOrder'));
}
Expand Down Expand Up @@ -977,7 +967,7 @@ public function inclusiveGateway2()

$concurrentFlowObjects = ['ShipOrder'];

$this->assertThat($concurrentFlowObjects, $this->contains($activityLog->get(0)->getActivity()->getId()));
$this->assertThat($concurrentFlowObjects, $this->containsEqual($activityLog->get(0)->getActivity()->getId()));

$this->assertThat($activityLog->get(1)->getActivity()->getId(), $this->equalTo('ArchiveOrder'));
}
Expand Down