public function __construct(IntrospectedWorkflow $instrospectedWorkflow) { $this->workflowName = $instrospectedWorkflow->getWorkflowName(); $colors = $this->assignUniqueColorToStates($instrospectedWorkflow->getIntrospectedStates()); $this->jsonableStates = $this->createStatesRepresentation($instrospectedWorkflow->getIntrospectedStates(), $colors); $this->jsonableTransitions = $this->createTransitionsRepresentation($instrospectedWorkflow->getIntrospectedTransitions(), $colors); }
public function test_it_should_introspect_workflow_transitions() { // Given $stateWorkflow = $this->createValidStateWorkflow(); $expectedStates = $this->createExpectedStates(); $expectedStates['a']->setIsRoot(); $expectedStates['c']->setIsLeaf(); $expectedTransitions = array('setToB_from_a' => new IntrospectedTransition('setToB', $expectedStates['a'], $expectedStates['b']), 'setToC_from_b' => new IntrospectedTransition('setToC', $expectedStates['b'], $expectedStates['c'])); // When $introspectedWorkflow = new SUT($stateWorkflow); $actual = $introspectedWorkflow->getIntrospectedTransitions(); // Then $this->assertEquals($expectedTransitions, $actual, 'Transitions are not well introspected anymore.'); }