From 2eed7b082f83630301e51f57ca8394de228a8605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Sun, 18 Aug 2019 21:14:58 -0500 Subject: first commit --- tests/phpunit/opencart/system/engine/EventTest.php | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/phpunit/opencart/system/engine/EventTest.php (limited to 'tests/phpunit/opencart/system/engine/EventTest.php') diff --git a/tests/phpunit/opencart/system/engine/EventTest.php b/tests/phpunit/opencart/system/engine/EventTest.php new file mode 100644 index 0000000..3fb8fb7 --- /dev/null +++ b/tests/phpunit/opencart/system/engine/EventTest.php @@ -0,0 +1,38 @@ +getMockBuilder('Event') + ->setMethods(array('createAction')) + ->disableOriginalConstructor() + ->getMock(); + + $actionMock = $this->getMockBuilder('Action') + ->disableOriginalConstructor() + ->getMock(); + + $actionMock->expects($this->exactly(3)) + ->method('execute'); + + $eventMock->expects($this->at(0)) + ->method('createAction') + ->with($this->equalTo('SomeExtraAction'), $this->equalTo(array())) + ->will($this->returnValue($actionMock)); + + $eventMock->expects($this->at(1)) + ->method('createAction') + ->with($this->equalTo('SomeAction'), $this->equalTo(array())) + ->will($this->returnValue($actionMock)); + + $eventMock->expects($this->at(2)) + ->method('createAction') + ->with($this->equalTo('SomeAnotherAction'), $this->equalTo(array())) + ->will($this->returnValue($actionMock)); + + $eventMock->register('some.event', 'SomeAction', 10); + $eventMock->register('some.event', 'SomeAnotherAction', 1); + $eventMock->register('some.event', 'SomeExtraAction', 100); + + $eventMock->trigger('some.event'); + } +} \ No newline at end of file -- cgit v1.2.3