diff --git a/src/Sylius/Bundle/FlowBundle/Tests/EventDispatcher/Event/FilterProcessEventTest.php b/src/Sylius/Bundle/FlowBundle/Tests/EventDispatcher/Event/FilterProcessEventTest.php new file mode 100644 index 0000000000..9bc84930a8 --- /dev/null +++ b/src/Sylius/Bundle/FlowBundle/Tests/EventDispatcher/Event/FilterProcessEventTest.php @@ -0,0 +1,48 @@ + + */ +class FilterProcessEventTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * @covers Sylius\Bundle\FlowBundle\EventDispatcher\Event\FilterProcessEvent + * @covers Sylius\Bundle\FlowBundle\EventDispatcher\SyliusFlowEvents + */ + public function shouldDispatchFilterProcessEvent() + { + $process = $this->getProcess(); + $testCase = $this; + $dispatcher = new EventDispatcher(); + + $dispatcher->addListener('sylius_flow.event.process.start', function (FilterProcessEvent $event) use ($testCase, $process) { + $testCase->assertSame($process, $event->getProcess()); + }); + + $event = new FilterProcessEvent($process); + $dispatcher->dispatch(SyliusFlowEvents::PROCESS_START, $event); + } + + private function getProcess() + { + return $this->getMock('Sylius\Bundle\FlowBundle\Process\ProcessInterface'); + } +} diff --git a/src/Sylius/Bundle/FlowBundle/Tests/EventDispatcher/Event/FilterStepEventTest.php b/src/Sylius/Bundle/FlowBundle/Tests/EventDispatcher/Event/FilterStepEventTest.php new file mode 100644 index 0000000000..bb0ef00329 --- /dev/null +++ b/src/Sylius/Bundle/FlowBundle/Tests/EventDispatcher/Event/FilterStepEventTest.php @@ -0,0 +1,48 @@ + + */ +class FilterStepEventTest extends \PHPUnit_Framework_TestCase +{ + /** + * @test + * @covers Sylius\Bundle\FlowBundle\EventDispatcher\Event\FilterStepEvent + * @covers Sylius\Bundle\FlowBundle\EventDispatcher\SyliusFlowEvents + */ + public function shouldDispatchFilterStepEvent() + { + $step = $this->getStep(); + $testCase = $this; + $dispatcher = new EventDispatcher(); + + $dispatcher->addListener('sylius_flow.event.step.display', function (FilterStepEvent $event) use ($testCase, $step) {; + $testCase->assertSame($step, $event->getStep()); + }); + + $event = new FilterStepEvent($step); + $dispatcher->dispatch(SyliusFlowEvents::STEP_DISPLAY, $event); + } + + private function getStep() + { + return $this->getMock('Sylius\Bundle\FlowBundle\Process\Step\StepInterface'); + } +}