@@ -14,7 +14,6 @@ |
||
14 | 14 | use Doctrine\ORM\EntityRepository; |
15 | 15 | use Gtt\Bundle\WorkflowExtensionsBundle\Entity\ScheduledJob; |
16 | 16 | use Gtt\Bundle\WorkflowExtensionsBundle\Exception\NonUniqueReschedulabeJobFoundException; |
17 | -use Gtt\Bundle\WorkflowExtensionsBundle\Schedule\Action\ScheduledAction; |
|
18 | 17 | use JMS\JobQueueBundle\Entity\Job; |
19 | 18 | |
20 | 19 | /** |
@@ -17,7 +17,6 @@ |
||
17 | 17 | use Gtt\Bundle\WorkflowExtensionsBundle\Action\Registry; |
18 | 18 | use Gtt\Bundle\WorkflowExtensionsBundle\Tests\Action\Reference\ContainerAwareActionReferenceInterface; |
19 | 19 | use Gtt\Bundle\WorkflowExtensionsBundle\WorkflowContext; |
20 | -use Symfony\Component\DependencyInjection\ContainerAwareInterface; |
|
21 | 20 | use Symfony\Component\DependencyInjection\ContainerInterface; |
22 | 21 | use Symfony\Component\Workflow\Workflow; |
23 | 22 |
@@ -135,7 +135,7 @@ |
||
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
138 | - * @return \PHPUnit_Framework_MockObject_MockObject|Registry |
|
138 | + * @return Registry |
|
139 | 139 | */ |
140 | 140 | private function prepareValidWorkflowRegistryMock() |
141 | 141 | { |
@@ -11,13 +11,9 @@ |
||
11 | 11 | |
12 | 12 | namespace Gtt\Bundle\WorkflowExtensionsBundle\Tests\Trigger\Event; |
13 | 13 | |
14 | -use Gtt\Bundle\WorkflowExtensionsBundle\Schedule\ScheduledTransition; |
|
15 | -use Gtt\Bundle\WorkflowExtensionsBundle\Schedule\TransitionScheduler; |
|
16 | -use Gtt\Bundle\WorkflowExtensionsBundle\Tests\TestCase; |
|
17 | 14 | use Gtt\Bundle\WorkflowExtensionsBundle\Trigger\Event\AbstractListener; |
18 | 15 | use Gtt\Bundle\WorkflowExtensionsBundle\WorkflowContext; |
19 | 16 | use Gtt\Bundle\WorkflowExtensionsBundle\WorkflowSubject\SubjectManipulator; |
20 | -use Gtt\Bundle\WorkflowExtensionsBundle\TransitionApplier; |
|
21 | 17 | use PHPUnit_Framework_MockObject_MockObject; |
22 | 18 | use PHPUnit_Framework_TestCase; |
23 | 19 | use Psr\Log\LoggerInterface; |
@@ -57,7 +57,6 @@ |
||
57 | 57 | /** |
58 | 58 | * {@inheritdoc} |
59 | 59 | * |
60 | - * @param string $expression expression to be executed by event |
|
61 | 60 | */ |
62 | 61 | public function registerEvent( |
63 | 62 | $eventName, |
@@ -81,7 +81,7 @@ |
||
81 | 81 | |
82 | 82 | foreach ($actions as $scheduledAction) { |
83 | 83 | $this->executeSafely( |
84 | - function () use ($workflowContext, $scheduledAction) { |
|
84 | + function() use ($workflowContext, $scheduledAction) { |
|
85 | 85 | $this->actionScheduler->scheduleAction($workflowContext, $scheduledAction); |
86 | 86 | }, |
87 | 87 | $eventName, |
@@ -66,11 +66,11 @@ |
||
66 | 66 | |
67 | 67 | $jobToSchedule = new Job(ExecuteActionCommand::COMMAND_NAME, |
68 | 68 | [ |
69 | - '--action=' . $scheduledAction->getName(), |
|
70 | - '--arguments=' . json_encode($scheduledAction->getArguments()), |
|
71 | - '--workflow=' . $workflowContext->getWorkflow()->getName(), |
|
72 | - '--subjectClass=' . get_class($workflowContext->getSubject()), |
|
73 | - '--subjectId=' . $workflowContext->getSubjectId(), |
|
69 | + '--action='.$scheduledAction->getName(), |
|
70 | + '--arguments='.json_encode($scheduledAction->getArguments()), |
|
71 | + '--workflow='.$workflowContext->getWorkflow()->getName(), |
|
72 | + '--subjectClass='.get_class($workflowContext->getSubject()), |
|
73 | + '--subjectId='.$workflowContext->getSubjectId(), |
|
74 | 74 | ] |
75 | 75 | ); |
76 | 76 |
@@ -363,7 +363,7 @@ |
||
363 | 363 | ->isRequired() |
364 | 364 | ->cannotBeEmpty() |
365 | 365 | ->info('Holds period defines offset from time of event catching for transition scheduling. '. |
366 | - 'See https://en.wikipedia.org/wiki/ISO_8601#Durations for format description') |
|
366 | + 'See https://en.wikipedia.org/wiki/ISO_8601#Durations for format description') |
|
367 | 367 | ->validate() |
368 | 368 | ->always() |
369 | 369 | ->then(function ($v) { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | ->end() |
95 | 95 | ->validate() |
96 | 96 | ->always() |
97 | - ->then(function ($v) { |
|
97 | + ->then(function($v) { |
|
98 | 98 | foreach ($v as $actionName => $actionConfig) { |
99 | 99 | if (!preg_match('/^[a-z0-9_]+$/i', $actionName)) { |
100 | 100 | throw new InvalidConfigurationException( |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | ->defaultValue([]) |
193 | 193 | ->beforeNormalization() |
194 | 194 | ->ifString() |
195 | - ->then(function ($v) { return array($v); }) |
|
195 | + ->then(function($v) { return array($v); }) |
|
196 | 196 | ->end() |
197 | 197 | ->useAttributeAsKey('name') |
198 | 198 | ->prototype('array') |
@@ -202,16 +202,16 @@ discard block |
||
202 | 202 | ->end() |
203 | 203 | ->beforeNormalization() |
204 | 204 | ->ifString() |
205 | - ->then(function ($v) { |
|
205 | + ->then(function($v) { |
|
206 | 206 | return ['arguments' => [$v]]; |
207 | 207 | }) |
208 | 208 | ->end() |
209 | 209 | ->beforeNormalization() |
210 | - ->ifTrue(function ($v) { |
|
210 | + ->ifTrue(function($v) { |
|
211 | 211 | // place arguments under 'arguments' key in order to validate it in common way |
212 | 212 | return is_array($v) && !(count($v) == 1 && array_key_exists('arguments', $v)); |
213 | 213 | }) |
214 | - ->then(function ($v) { |
|
214 | + ->then(function($v) { |
|
215 | 215 | return ['arguments' => $v]; |
216 | 216 | }) |
217 | 217 | ->end() |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | ->end() |
291 | 291 | ->end() |
292 | 292 | ->beforeNormalization() |
293 | - ->ifTrue(function ($v) { |
|
293 | + ->ifTrue(function($v) { |
|
294 | 294 | return is_scalar($v) || is_array($v) && !ArrayUtils::isArrayAssoc($v); |
295 | 295 | }) |
296 | - ->then(function ($v) { |
|
296 | + ->then(function($v) { |
|
297 | 297 | $type = is_scalar($v) ? ActionArgumentTypes::TYPE_SCALAR : ActionArgumentTypes::TYPE_ARRAY; |
298 | 298 | return [ |
299 | 299 | 'type' => $type, |
@@ -302,10 +302,10 @@ discard block |
||
302 | 302 | }) |
303 | 303 | ->end() |
304 | 304 | ->validate() |
305 | - ->ifTrue(function ($v) { |
|
305 | + ->ifTrue(function($v) { |
|
306 | 306 | return is_array($v) && $v['type'] == ActionArgumentTypes::TYPE_ARRAY; |
307 | 307 | }) |
308 | - ->then(function ($v) { |
|
308 | + ->then(function($v) { |
|
309 | 309 | // recursive processing of array values |
310 | 310 | $treeBuilder = new TreeBuilder(); |
311 | 311 | $node = $treeBuilder->root('value'); |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | ->end() |
320 | 320 | ->end() |
321 | 321 | ->validate() |
322 | - ->ifTrue(function ($v) { |
|
322 | + ->ifTrue(function($v) { |
|
323 | 323 | return ArrayUtils::isArrayAssoc($v, false); |
324 | 324 | }) |
325 | 325 | // To provide cross-platform arguments handling we are not supporting here assoc arrays |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | 'See https://en.wikipedia.org/wiki/ISO_8601#Durations for format description') |
367 | 367 | ->validate() |
368 | 368 | ->always() |
369 | - ->then(function ($v) { |
|
369 | + ->then(function($v) { |
|
370 | 370 | try { |
371 | 371 | new DateInterval($v); |
372 | 372 | |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | ->prototype('array') |
408 | 408 | ->beforeNormalization() |
409 | 409 | ->ifString() |
410 | - ->then(function ($v) { return ['expression' => $v]; }) |
|
410 | + ->then(function($v) { return ['expression' => $v]; }) |
|
411 | 411 | ->end() |
412 | 412 | ->children() |
413 | 413 | ->scalarNode('expression') |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | ->beforeNormalization() |
439 | 439 | ->always() |
440 | 440 | ->then( |
441 | - function ($v) { |
|
441 | + function($v) { |
|
442 | 442 | if (isset($v) && is_array($v)) { |
443 | 443 | foreach ($v as $key => $value) { |
444 | 444 | unset($v[$key]); |
@@ -73,7 +73,7 @@ |
||
73 | 73 | $expression = $this->supportedEventsConfig[$eventName][$workflowContext->getWorkflow()->getName()]['expression']; |
74 | 74 | |
75 | 75 | $this->executeSafely( |
76 | - function () use ($expression, $event, $workflowContext) { |
|
76 | + function() use ($expression, $event, $workflowContext) { |
|
77 | 77 | $this->actionLanguage->evaluate($expression, ['event' => $event, 'workflowContext' => $workflowContext]); |
78 | 78 | }, |
79 | 79 | $eventName, |
@@ -80,7 +80,7 @@ |
||
80 | 80 | |
81 | 81 | foreach ($actions as $action) { |
82 | 82 | $this->executeSafely( |
83 | - function () use ($workflowContext, $action) { |
|
83 | + function() use ($workflowContext, $action) { |
|
84 | 84 | $this->actionExecutor->execute($workflowContext, $action->getName(), $action->getArguments()); |
85 | 85 | }, |
86 | 86 | $eventName, |