Merge branch '3.4' into 4.2

* 3.4:
  Fixes a small doc blocks syntax error
  Small grammar mistake in documentation
  [Workflow] Do not trigger extra guard
This commit is contained in:
Fabien Potencier 2019-05-27 07:57:45 +02:00
commit 2314f81891
3 changed files with 41 additions and 2 deletions

View File

@ -1907,7 +1907,7 @@ class Request
}
}
/*
/**
* Returns the prefix as encoded in the string when the string starts with
* the given prefix, false otherwise.
*

View File

@ -29,7 +29,7 @@ interface ControllerResolverInterface
* As several resolvers can exist for a single application, a resolver must
* return false when it is not able to determine the controller.
*
* The resolver must only throw an exception when it should be able to load
* The resolver must only throw an exception when it should be able to load a
* controller but cannot because of some errors made by the developer.
*
* @return callable|false A PHP callable representing the Controller,

View File

@ -433,6 +433,45 @@ class WorkflowTest extends TestCase
$this->assertSame($eventNameExpected, $eventDispatcher->dispatchedEvents);
}
public function testApplyDoesNotTriggerExtraGuardWithEventDispatcher()
{
$transitions[] = new Transition('a-b', 'a', 'b');
$transitions[] = new Transition('a-c', 'a', 'c');
$definition = new Definition(['a', 'b', 'c'], $transitions);
$subject = new \stdClass();
$subject->marking = null;
$eventDispatcher = new EventDispatcherMock();
$workflow = new Workflow($definition, new MultipleStateMarkingStore(), $eventDispatcher, 'workflow_name');
$eventNameExpected = [
'workflow.guard',
'workflow.workflow_name.guard',
'workflow.workflow_name.guard.a-b',
'workflow.leave',
'workflow.workflow_name.leave',
'workflow.workflow_name.leave.a',
'workflow.transition',
'workflow.workflow_name.transition',
'workflow.workflow_name.transition.a-b',
'workflow.enter',
'workflow.workflow_name.enter',
'workflow.workflow_name.enter.b',
'workflow.entered',
'workflow.workflow_name.entered',
'workflow.workflow_name.entered.b',
'workflow.completed',
'workflow.workflow_name.completed',
'workflow.workflow_name.completed.a-b',
'workflow.announce',
'workflow.workflow_name.announce',
];
$marking = $workflow->apply($subject, 'a-b');
$this->assertSame($eventNameExpected, $eventDispatcher->dispatchedEvents);
}
public function testEventName()
{
$definition = $this->createComplexWorkflowDefinition();