mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-22 21:19:46 +05:30
More tests
This commit is contained in:
parent
b694cca743
commit
20032f33a2
@ -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": [
|
||||||
{
|
{
|
||||||
|
@ -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
|
||||||
|
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user