Skip to content

Commit abfe647

Browse files
author
Enno Woortmann
committed
Don't include output formatters in test coverage
1 parent f1ca38c commit abfe647

4 files changed

Lines changed: 38 additions & 32 deletions

File tree

phpunit.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
<include>
1616
<directory>src</directory>
1717
</include>
18+
<exclude>
19+
<directory>src/State/ExecutionLog/OutputFormat</directory>
20+
</exclude>
1821
</coverage>
1922
<testsuite name="PHPWorkflow">
2023
<directory>tests</directory>

tests/LoopTest.php

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
use PHPUnit\Framework\TestCase;
99
use PHPWorkflow\State\WorkflowContainer;
1010
use PHPWorkflow\Step\Loop;
11-
use PHPWorkflow\Step\LoopControl;
1211
use PHPWorkflow\Step\NestedWorkflow;
13-
use PHPWorkflow\Step\WorkflowStep;
1412
use PHPWorkflow\Workflow;
1513
use PHPWorkflow\WorkflowControl;
1614

@@ -797,33 +795,4 @@ public function failStepDataProvider(): array
797795
'By failing step' => [fn (WorkflowControl $control) => $control->failStep('Fail Message')],
798796
];
799797
}
800-
801-
private function entryLoopControl(): LoopControl
802-
{
803-
return $this->setupLoop(
804-
'process-loop',
805-
function (WorkflowControl $control, WorkflowContainer $container): bool {
806-
$entries = $container->get('entries');
807-
808-
if (empty($entries)) {
809-
return false;
810-
}
811-
812-
$container->set('entry', array_shift($entries));
813-
$container->set('entries', $entries);
814-
815-
return true;
816-
},
817-
);
818-
}
819-
820-
private function processEntry(): WorkflowStep
821-
{
822-
return $this->setupStep(
823-
'process-test',
824-
function (WorkflowControl $control, WorkflowContainer $container) {
825-
$control->attachStepInfo("Process entry " . $container->get('entry'));
826-
},
827-
);
828-
}
829798
}

tests/OutputFormatterTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66

77
use PHPUnit\Framework\TestCase;
88
use PHPWorkflow\State\ExecutionLog\OutputFormat\GraphViz;
9+
use PHPWorkflow\State\ExecutionLog\OutputFormat\WorkflowGraph;
10+
use PHPWorkflow\State\WorkflowContainer;
11+
use PHPWorkflow\Step\Loop;
12+
use PHPWorkflow\Step\NestedWorkflow;
913
use PHPWorkflow\Workflow;
14+
use PHPWorkflow\WorkflowControl;
1015

1116
/**
1217
* Class OutputFormatterTest
@@ -17,7 +22,7 @@ class OutputFormatterTest extends TestCase
1722
{
1823
use WorkflowTestTrait, WorkflowSetupTrait;
1924

20-
public function testCustomOutputFormatter(): void
25+
public function testGraphVizOutputFormatter(): void
2126
{
2227
$result = (new Workflow('test'))
2328
->process($this->setupEmptyStep('process-test'))

tests/WorkflowSetupTrait.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,35 @@ public function executeNextIteration(
6767
};
6868
}
6969

70+
private function entryLoopControl(): LoopControl
71+
{
72+
return $this->setupLoop(
73+
'process-loop',
74+
function (WorkflowControl $control, WorkflowContainer $container): bool {
75+
$entries = $container->get('entries');
76+
77+
if (empty($entries)) {
78+
return false;
79+
}
80+
81+
$container->set('entry', array_shift($entries));
82+
$container->set('entries', $entries);
83+
84+
return true;
85+
},
86+
);
87+
}
88+
89+
private function processEntry(): WorkflowStep
90+
{
91+
return $this->setupStep(
92+
'process-test',
93+
function (WorkflowControl $control, WorkflowContainer $container) {
94+
$control->attachStepInfo("Process entry " . $container->get('entry'));
95+
},
96+
);
97+
}
98+
7099
public function failDataProvider(): array
71100
{
72101
return [

0 commit comments

Comments
 (0)