1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace CWP\CWP\Tests\Extensions; |
4
|
|
|
|
5
|
|
|
use CWP\CWP\Extensions\CwpWorkflowDefinitionExtension; |
6
|
|
|
use SilverStripe\Core\Config\Config; |
7
|
|
|
use SilverStripe\Core\Injector\Injector; |
8
|
|
|
use SilverStripe\Dev\FunctionalTest; |
9
|
|
|
use SilverStripe\ORM\DB; |
10
|
|
|
use Symbiote\AdvancedWorkflow\DataObjects\WorkflowDefinition; |
|
|
|
|
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* Tests the data extension {@link CWPWorkflowDefinitionExtension} |
14
|
|
|
*/ |
15
|
|
|
class WorkflowDefinitionExtensionTest extends FunctionalTest |
16
|
|
|
{ |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @var Boolean If set to TRUE, this will force a test database to be generated |
20
|
|
|
* in {@link setUp()}. Note that this flag is overruled by the presence of a |
21
|
|
|
* {@link $fixture_file}, which always forces a database build. |
22
|
|
|
*/ |
23
|
|
|
protected $usesDatabase = true; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Tests the config option that controls the creation of a default workflow definition |
27
|
|
|
* |
28
|
|
|
* @return void |
29
|
|
|
*/ |
30
|
|
|
public function testCreateDefaultWorkflowTest() |
31
|
|
|
{ |
32
|
|
|
if (!class_exists(WorkflowDefinition::class)) { |
33
|
|
|
$this->markTestSkipped('This test requires the advancedworkflow module to be installed'); |
34
|
|
|
} |
35
|
|
|
|
36
|
|
|
DB::quiet(); |
37
|
|
|
|
38
|
|
|
// test disabling the default workflow definition |
39
|
|
|
Config::modify()->set(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', false); |
40
|
|
|
$workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class); |
41
|
|
|
$workflowExtn->requireDefaultRecords(); |
42
|
|
|
$definition = WorkflowDefinition::get()->first(); |
43
|
|
|
$this->assertNull($definition); |
44
|
|
|
|
45
|
|
|
// test enabling the default workflow definition |
46
|
|
|
Config::modify()->set(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', true); |
47
|
|
|
$workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class); |
48
|
|
|
$workflowExtn->requireDefaultRecords(); |
49
|
|
|
$definition = WorkflowDefinition::get()->first(); |
50
|
|
|
$this->assertNotNull($definition); |
51
|
|
|
} |
52
|
|
|
} |
53
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths