|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the Global Trading Technologies Ltd workflow-extension-bundle package. |
|
4
|
|
|
* |
|
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
6
|
|
|
* file that was distributed with this source code. |
|
7
|
|
|
* |
|
8
|
|
|
* (c) fduch <[email protected]> |
|
9
|
|
|
* Date: 30.08.16 |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Gtt\Bundle\WorkflowExtensionsBundle\Tests\DependencyInjection\Compiler; |
|
13
|
|
|
|
|
14
|
|
|
use Gtt\Bundle\WorkflowExtensionsBundle\DependencyInjection\Compiler\CheckSubjectManipulatorConfigPass; |
|
15
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
16
|
|
|
use Symfony\Component\DependencyInjection\Definition; |
|
17
|
|
|
use Symfony\Component\DependencyInjection\Reference; |
|
18
|
|
|
|
|
19
|
|
|
class CheckSubjectManipulatorConfigPassTest extends \PHPUnit_Framework_TestCase |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException |
|
23
|
|
|
*/ |
|
24
|
|
|
public function testThrowingExceptionIfTargetSubjectClassesNotConfigured() |
|
25
|
|
|
{ |
|
26
|
|
|
$container = new ContainerBuilder(); |
|
27
|
|
|
$container->addCompilerPass(new CheckSubjectManipulatorConfigPass()); |
|
28
|
|
|
|
|
29
|
|
|
$registryDefinition = new Definition("RegistryClass"); |
|
30
|
|
|
$container->setDefinition('workflow.test', new Definition('class')); |
|
31
|
|
|
$container->setDefinition('gtt.workflow.transition_scheduler', new Definition('class')); |
|
32
|
|
|
|
|
33
|
|
|
$workflowName = 'test'; |
|
34
|
|
|
$registryDefinition->addMethodCall( |
|
35
|
|
|
CheckSubjectManipulatorConfigPass::WORKFLOW_REGISTRY_ADD_WORKFLOW_METHOD_NAME, |
|
36
|
|
|
[ |
|
37
|
|
|
new Reference(CheckSubjectManipulatorConfigPass::WORKFLOW_ID_PREFIX.$workflowName), |
|
38
|
|
|
'\Some\Target\Class' |
|
39
|
|
|
] |
|
40
|
|
|
); |
|
41
|
|
|
$container->setDefinition(CheckSubjectManipulatorConfigPass::WORKFLOW_REGISTRY_ID, $registryDefinition); |
|
42
|
|
|
|
|
43
|
|
|
$container->setParameter('gtt.workflow.subject_classes_with_subject_from_domain', ['\Some\Target\AnotherClass']); |
|
44
|
|
|
$container->setParameter('gtt.workflow.workflows_with_scheduling', [$workflowName]); |
|
45
|
|
|
|
|
46
|
|
|
$container->compile(); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|