From 3d44665484a8594463f29d3efbbcd20cba0add4c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Thu, 26 Dec 2019 12:00:29 +0200 Subject: [PATCH] Added Event lib unit tests --- phpunit.xml | 1 + tests/unit/Event/EventTest.php | 51 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 tests/unit/Event/EventTest.php diff --git a/phpunit.xml b/phpunit.xml index f897107fe..b0c837272 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -11,6 +11,7 @@ ./tests/e2e/ + ./tests/unit/ \ No newline at end of file diff --git a/tests/unit/Event/EventTest.php b/tests/unit/Event/EventTest.php new file mode 100644 index 000000000..143f8b70c --- /dev/null +++ b/tests/unit/Event/EventTest.php @@ -0,0 +1,51 @@ +getServer('_APP_REDIS_HOST', ''); + $redisPort = $request->getServer('_APP_REDIS_PORT', ''); + \Resque::setBackend($redisHost.':'.$redisPort); + + $this->queue = 'v1-tests' . uniqid(); + $this->object = new Event($this->queue, 'TestsV1'); + } + + public function tearDown() + { + } + + public function testParams() + { + $this->object + ->setParam('key1', 'value1') + ->setParam('key2', 'value2') + ; + + $this->object->trigger(); + + $this->assertEquals('value1', $this->object->getParam('key1')); + $this->assertEquals('value2', $this->object->getParam('key2')); + $this->assertEquals(null, $this->object->getParam('key3')); + $this->assertEquals(\Resque::size($this->queue), 1); + } +} \ No newline at end of file