1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace CWP\CWP\Tests\Extensions; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
|
7
|
|
|
|
8
|
|
|
|
9
|
|
|
use WorkflowDefinition; |
|
|
|
|
10
|
|
|
use SilverStripe\ORM\DB; |
11
|
|
|
use SilverStripe\Core\Config\Config; |
12
|
|
|
use CWP\CWP\Extensions\CwpWorkflowDefinitionExtension; |
13
|
|
|
use SilverStripe\Core\Injector\Injector; |
14
|
|
|
use SilverStripe\Dev\FunctionalTest; |
15
|
|
|
|
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Tests the data extension {@link: CWPWorkflowDefinitionExtension} |
19
|
|
|
* |
20
|
|
|
* @package framework |
21
|
|
|
* @subpackage tests |
22
|
|
|
*/ |
23
|
|
|
class WorkflowDefinitionExtensionTest extends FunctionalTest { |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @var Boolean If set to TRUE, this will force a test database to be generated |
27
|
|
|
* in {@link setUp()}. Note that this flag is overruled by the presence of a |
28
|
|
|
* {@link $fixture_file}, which always forces a database build. |
29
|
|
|
*/ |
30
|
|
|
protected $usesDatabase = true; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Tests the config option that controls the creation of a default workflow definition |
34
|
|
|
* |
35
|
|
|
* @return void |
36
|
|
|
*/ |
37
|
|
|
public function testCreateDefaultWorkflowTest() { |
38
|
|
|
DB::quiet(); |
39
|
|
|
|
40
|
|
|
// test disabling the default workflow definition |
41
|
|
|
Config::inst()->update(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', false); |
|
|
|
|
42
|
|
|
$workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class); |
43
|
|
|
$workflowExtn->requireDefaultRecords(); |
44
|
|
|
$definition = WorkflowDefinition::get()->first(); |
45
|
|
|
$this->assertNull($definition); |
46
|
|
|
|
47
|
|
|
// test enabling the default workflow definition |
48
|
|
|
Config::inst()->update(CwpWorkflowDefinitionExtension::class, 'create_default_workflow', true); |
49
|
|
|
$workflowExtn = Injector::inst()->create(CwpWorkflowDefinitionExtension::class); |
50
|
|
|
$workflowExtn->requireDefaultRecords(); |
51
|
|
|
$definition = WorkflowDefinition::get()->first(); |
52
|
|
|
$this->assertNotNull($definition); |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|
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