More tests

This commit is contained in:
Alex Bilbie 2014-07-12 12:07:46 +01:00
parent b694cca743
commit 20032f33a2
3 changed files with 15 additions and 4 deletions

View File

@ -6,13 +6,14 @@
"require": { "require": {
"php": ">=5.4.0", "php": ">=5.4.0",
"symfony/http-foundation": "~2.1", "symfony/http-foundation": "~2.1",
"league/event": "0.1" "league/event": "0.2.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.0", "phpunit/phpunit": "~4.0",
"mockery/mockery": "~0.9", "mockery/mockery": "~0.9",
"league/phpunit-coverage-listener": "~1.0", "league/phpunit-coverage-listener": "~1.0",
"squizlabs/php_codesniffer": "1.*" "squizlabs/php_codesniffer": "1.*",
"codeception/codeception": "2.0.2"
}, },
"repositories": [ "repositories": [
{ {

View File

@ -11,10 +11,10 @@
namespace League\OAuth2\Server\Event; namespace League\OAuth2\Server\Event;
use League\Event\EventAbstract; use League\Event\AbstractEvent;
use League\OAuth2\Server\Entity\SessionEntity; use League\OAuth2\Server\Entity\SessionEntity;
class SessionOwnerEvent extends EventAbstract class SessionOwnerEvent extends AbstractEvent
{ {
/** /**
* Session entity * Session entity

View File

@ -9,11 +9,21 @@ class AbstractServerTest extends \PHPUnit_Framework_TestCase
public function testSetGet() public function testSetGet()
{ {
$server = new StubAbstractServer(); $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->getRequest() instanceof \Symfony\Component\HttpFoundation\Request);
$this->assertTrue($server->getEventEmitter() instanceof \League\Event\Emitter);
$server2 = new StubAbstractServer(); $server2 = new StubAbstractServer();
$server2->setRequest((new \Symfony\Component\HttpFoundation\Request)); $server2->setRequest((new \Symfony\Component\HttpFoundation\Request));
$server2->setEventEmitter(1);
$this->assertTrue($server2->getRequest() instanceof \Symfony\Component\HttpFoundation\Request); $this->assertTrue($server2->getRequest() instanceof \Symfony\Component\HttpFoundation\Request);
} }
public function testGetStorageException() public function testGetStorageException()