From 20032f33a25f418063347001725b9bd8daa7de17 Mon Sep 17 00:00:00 2001 From: Alex Bilbie Date: Sat, 12 Jul 2014 12:07:46 +0100 Subject: [PATCH] More tests --- composer.json | 5 +++-- src/Event/SessionOwnerEvent.php | 4 ++-- tests/AbstractServerTest.php | 10 ++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 24105daa..aff71b87 100644 --- a/composer.json +++ b/composer.json @@ -6,13 +6,14 @@ "require": { "php": ">=5.4.0", "symfony/http-foundation": "~2.1", - "league/event": "0.1" + "league/event": "0.2.0" }, "require-dev": { "phpunit/phpunit": "~4.0", "mockery/mockery": "~0.9", "league/phpunit-coverage-listener": "~1.0", - "squizlabs/php_codesniffer": "1.*" + "squizlabs/php_codesniffer": "1.*", + "codeception/codeception": "2.0.2" }, "repositories": [ { diff --git a/src/Event/SessionOwnerEvent.php b/src/Event/SessionOwnerEvent.php index f8c6be76..621d0a83 100644 --- a/src/Event/SessionOwnerEvent.php +++ b/src/Event/SessionOwnerEvent.php @@ -11,10 +11,10 @@ namespace League\OAuth2\Server\Event; -use League\Event\EventAbstract; +use League\Event\AbstractEvent; use League\OAuth2\Server\Entity\SessionEntity; -class SessionOwnerEvent extends EventAbstract +class SessionOwnerEvent extends AbstractEvent { /** * Session entity diff --git a/tests/AbstractServerTest.php b/tests/AbstractServerTest.php index 5ac009e3..8933e137 100644 --- a/tests/AbstractServerTest.php +++ b/tests/AbstractServerTest.php @@ -9,11 +9,21 @@ class AbstractServerTest extends \PHPUnit_Framework_TestCase public function testSetGet() { $server = new StubAbstractServer(); + $var = 0; + $server->addEventListener('event.name', function() use ($var) { + $var++; + $this->assertSame(1, $var); + }); + $server->getEventEmitter()->emit('event.name'); $this->assertTrue($server->getRequest() instanceof \Symfony\Component\HttpFoundation\Request); + $this->assertTrue($server->getEventEmitter() instanceof \League\Event\Emitter); + $server2 = new StubAbstractServer(); $server2->setRequest((new \Symfony\Component\HttpFoundation\Request)); + $server2->setEventEmitter(1); $this->assertTrue($server2->getRequest() instanceof \Symfony\Component\HttpFoundation\Request); + } public function testGetStorageException()