public function testGetWithSuccess() { $workflow =
$this->registry->
get(new Subject1());
$this->
assertInstanceOf(Workflow::
class,
$workflow);
$this->
assertSame('workflow1',
$workflow->
getName());
$workflow =
$this->registry->
get(new Subject1(), 'workflow1'
);
$this->
assertInstanceOf(Workflow::
class,
$workflow);
$this->
assertSame('workflow1',
$workflow->
getName());
$workflow =
$this->registry->
get(new Subject2(), 'workflow2'
);
$this->
assertInstanceOf(Workflow::
class,
$workflow);
$this->
assertSame('workflow2',
$workflow->
getName());
} public function testGetWithMultipleMatch() { $this->
expectException(InvalidArgumentException::
class);
$this->
expectExceptionMessage('Too many workflows (workflow2, workflow3) match this subject (Symfony\Component\Workflow\Tests\Subject2); set a different name on each and use the second (name) argument of this method.'
);
$w1 =
$this->registry->
get(new Subject2());
$this->
assertInstanceOf(Workflow::
class,
$w1);
$this->
assertSame('workflow1',
$w1->
getName());
}