Skip to content

Commit 0df81b0

Browse files
committed
Add failing test when adding a listener with a null priority
The underlying Emitter doesn't allow the priority to be null. However we set priority to null if it's not provided in the config.
1 parent f37ef8b commit 0df81b0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test/AuthorizationServerFactoryTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace MezzioTest\Authentication\OAuth2;
66

7+
use Laminas\Diactoros\ServerRequest;
78
use League\Event\ListenerInterface;
89
use League\Event\ListenerProviderInterface;
910
use League\OAuth2\Server\AuthorizationServer;
@@ -133,6 +134,10 @@ static function (RequestEvent $event): void {
133134
$result = $factory($mockContainer);
134135

135136
self::assertInstanceOf(AuthorizationServer::class, $result);
137+
138+
// Ensure listeners have been registered correctly. If they have not, then emitting an event will fail
139+
$request = $this->createMock(ServerRequest::class);
140+
$result->getEmitter()->emit(new RequestEvent(RequestEvent::CLIENT_AUTHENTICATION_FAILED, $request));
136141
}
137142

138143
public function testInvokeWithListenerConfigMissingServiceThrowsException(): void

0 commit comments

Comments
 (0)