Skip to content

Commit 70bf835

Browse files
formatting
1 parent 09d284b commit 70bf835

File tree

5 files changed

+50
-50
lines changed

5 files changed

+50
-50
lines changed

tests/Handlers/AbstractTokenHandlerTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testSetJwtValidator(): void
4646

4747
$jwtValidator = $this->createMock(JwtValidatorInterface::class);
4848
$jwtValidator
49-
->expects($this->once())
49+
->expects(self::once())
5050
->method('validateJwt')
5151
->with($request, 'abcdef', 'client1')
5252
->willReturn(['foo' => 'bar']);
@@ -141,7 +141,7 @@ public function testValidateAccessToken(): void
141141
{
142142
$accessTokenRepository = $this->createMock(AccessTokenRepositoryInterface::class);
143143
$accessTokenRepository
144-
->expects($this->once())
144+
->expects(self::once())
145145
->method('isAccessTokenRevoked')
146146
->with('access1')
147147
->willReturn(false);
@@ -177,7 +177,7 @@ public function testValidateAccessTokenIsRevoked(): void
177177
{
178178
$accessTokenRepository = $this->createMock(AccessTokenRepositoryInterface::class);
179179
$accessTokenRepository
180-
->expects($this->once())
180+
->expects(self::once())
181181
->method('isAccessTokenRevoked')
182182
->with('access1')
183183
->willReturn(true);
@@ -203,7 +203,7 @@ public function testValidateAccessTokenIsRevoked(): void
203203
public function testValidateAccessTokenIsExpired(): void
204204
{
205205
$accessTokenRepository = $this->createMock(AccessTokenRepositoryInterface::class);
206-
$accessTokenRepository->expects($this->never())->method('isAccessTokenRevoked');
206+
$accessTokenRepository->expects(self::never())->method('isAccessTokenRevoked');
207207

208208
$handler = $this->getAbstractTokenHandler();
209209
$handler->setAccessTokenRepository($accessTokenRepository);
@@ -226,7 +226,7 @@ public function testValidateAccessTokenIsExpired(): void
226226
public function testValidateAccessTokenWithMismatchClient(): void
227227
{
228228
$accessTokenRepository = $this->createMock(AccessTokenRepositoryInterface::class);
229-
$accessTokenRepository->expects($this->never())->method('isAccessTokenRevoked');
229+
$accessTokenRepository->expects(self::never())->method('isAccessTokenRevoked');
230230

231231
$handler = $this->getAbstractTokenHandler();
232232
$handler->setAccessTokenRepository($accessTokenRepository);
@@ -249,7 +249,7 @@ public function testValidateAccessTokenWithMismatchClient(): void
249249
public function testValidateAccessTokenWithInvalidToken(): void
250250
{
251251
$accessTokenRepository = $this->createMock(AccessTokenRepositoryInterface::class);
252-
$accessTokenRepository->expects($this->never())->method('isAccessTokenRevoked');
252+
$accessTokenRepository->expects(self::never())->method('isAccessTokenRevoked');
253253

254254
$handler = $this->getAbstractTokenHandler();
255255
$handler->setAccessTokenRepository($accessTokenRepository);
@@ -268,7 +268,7 @@ public function testValidateRefreshToken(): void
268268
{
269269
$refreshTokenRepository = $this->createMock(RefreshTokenRepositoryInterface::class);
270270
$refreshTokenRepository
271-
->expects($this->once())
271+
->expects(self::once())
272272
->method('isRefreshTokenRevoked')
273273
->with('refresh1')
274274
->willReturn(false);
@@ -300,7 +300,7 @@ public function testValidateRefreshTokenIsRevoked(): void
300300
{
301301
$refreshTokenRepository = $this->createMock(RefreshTokenRepositoryInterface::class);
302302
$refreshTokenRepository
303-
->expects($this->once())
303+
->expects(self::once())
304304
->method('isRefreshTokenRevoked')
305305
->with('refresh1')
306306
->willReturn(true);
@@ -325,7 +325,7 @@ public function testValidateRefreshTokenIsRevoked(): void
325325
public function testValidateRefreshTokenIsExpired(): void
326326
{
327327
$refreshTokenRepository = $this->createMock(RefreshTokenRepositoryInterface::class);
328-
$refreshTokenRepository->expects($this->never())->method('isRefreshTokenRevoked');
328+
$refreshTokenRepository->expects(self::never())->method('isRefreshTokenRevoked');
329329

330330
$handler = $this->getAbstractTokenHandler();
331331
$handler->setRefreshTokenRepository($refreshTokenRepository);
@@ -347,7 +347,7 @@ public function testValidateRefreshTokenIsExpired(): void
347347
public function testValidateRefreshTokenWithMismatchClient(): void
348348
{
349349
$refreshTokenRepository = $this->createMock(RefreshTokenRepositoryInterface::class);
350-
$refreshTokenRepository->expects($this->never())->method('isRefreshTokenRevoked');
350+
$refreshTokenRepository->expects(self::never())->method('isRefreshTokenRevoked');
351351

352352
$handler = $this->getAbstractTokenHandler();
353353
$handler->setRefreshTokenRepository($refreshTokenRepository);
@@ -369,7 +369,7 @@ public function testValidateRefreshTokenWithMismatchClient(): void
369369
public function testValidateRefreshTokenWithInvalidToken(): void
370370
{
371371
$refreshTokenRepository = $this->createMock(RefreshTokenRepositoryInterface::class);
372-
$refreshTokenRepository->expects($this->never())->method('isRefreshTokenRevoked');
372+
$refreshTokenRepository->expects(self::never())->method('isRefreshTokenRevoked');
373373

374374
$handler = $this->getAbstractTokenHandler();
375375
$handler->setRefreshTokenRepository($refreshTokenRepository);

tests/Handlers/TokenIntrospectionHandlerTest.php

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ public function testRespondToRequestForAccessToken(): void
2121
$client->setIdentifier('client1');
2222

2323
$clientRepository = $this->createMock(ClientRepositoryInterface::class);
24-
$clientRepository->expects($this->once())
24+
$clientRepository->expects(self::once())
2525
->method('getClientEntity')
2626
->with('client1')
2727
->willReturn($client);
2828
$clientRepository
29-
->expects($this->once())
29+
->expects(self::once())
3030
->method('validateClient')
3131
->with('client1', 'secret1', null)
3232
->willReturn(true);
@@ -39,7 +39,7 @@ public function testRespondToRequestForAccessToken(): void
3939

4040
$handler = $this->getMockBuilder(TokenIntrospectionHandler::class)->onlyMethods(['validateAccessToken'])->getMock();
4141
$handler->setClientRepository($clientRepository);
42-
$handler->expects($this->once())
42+
$handler->expects(self::once())
4343
->method('validateAccessToken')
4444
->with($request, 'token1', $client)
4545
->willReturn(['access_token', ['jti' => 'access1']]);
@@ -52,7 +52,7 @@ public function testRespondToRequestForAccessToken(): void
5252
self::assertSame([
5353
'active' => true,
5454
'token_type' => 'Bearer',
55-
'jti' => 'access1'
55+
'jti' => 'access1',
5656
], json_decode($response->getBody()->getContents(), true));
5757
}
5858

@@ -63,12 +63,12 @@ public function testRespondToRequestForRefreshToken(): void
6363
$client->setIdentifier('client1');
6464

6565
$clientRepository = $this->createMock(ClientRepositoryInterface::class);
66-
$clientRepository->expects($this->once())
66+
$clientRepository->expects(self::once())
6767
->method('getClientEntity')
6868
->with('client1')
6969
->willReturn($client);
7070
$clientRepository
71-
->expects($this->once())
71+
->expects(self::once())
7272
->method('validateClient')
7373
->with('client1', 'secret1', null)
7474
->willReturn(true);
@@ -81,7 +81,7 @@ public function testRespondToRequestForRefreshToken(): void
8181

8282
$handler = $this->getMockBuilder(TokenIntrospectionHandler::class)->onlyMethods(['validateRefreshToken'])->getMock();
8383
$handler->setClientRepository($clientRepository);
84-
$handler->expects($this->once())
84+
$handler->expects(self::once())
8585
->method('validateRefreshToken')
8686
->with($request, 'token1', $client)
8787
->willReturn(['refresh_token', ['refresh_token_id' => 'refresh1']]);
@@ -104,12 +104,12 @@ public function testRespondToRequestForInvalidToken(): void
104104
$client->setIdentifier('client1');
105105

106106
$clientRepository = $this->createMock(ClientRepositoryInterface::class);
107-
$clientRepository->expects($this->once())
107+
$clientRepository->expects(self::once())
108108
->method('getClientEntity')
109109
->with('client1')
110110
->willReturn($client);
111111
$clientRepository
112-
->expects($this->once())
112+
->expects(self::once())
113113
->method('validateClient')
114114
->with('client1', 'secret1', null)
115115
->willReturn(true);
@@ -123,11 +123,11 @@ public function testRespondToRequestForInvalidToken(): void
123123
$handler = $this->getMockBuilder(TokenIntrospectionHandler::class)
124124
->onlyMethods(['validateAccessToken', 'validateRefreshToken'])->getMock();
125125
$handler->setClientRepository($clientRepository);
126-
$handler->expects($this->once())
126+
$handler->expects(self::once())
127127
->method('validateAccessToken')
128128
->with($request, 'token1', $client)
129129
->willReturn(null);
130-
$handler->expects($this->once())
130+
$handler->expects(self::once())
131131
->method('validateRefreshToken')
132132
->with($request, 'token1', $client)
133133
->willReturn(null);
@@ -147,12 +147,12 @@ public function testSetResponseType(): void
147147
$client->setIdentifier('client1');
148148

149149
$clientRepository = $this->createMock(ClientRepositoryInterface::class);
150-
$clientRepository->expects($this->once())
150+
$clientRepository->expects(self::once())
151151
->method('getClientEntity')
152152
->with('client1')
153153
->willReturn($client);
154154
$clientRepository
155-
->expects($this->once())
155+
->expects(self::once())
156156
->method('validateClient')
157157
->with('client1', 'secret1', null)
158158
->willReturn(true);
@@ -166,15 +166,15 @@ public function testSetResponseType(): void
166166
$response = new Response();
167167

168168
$responseType = $this->createMock(IntrospectionResponseTypeInterface::class);
169-
$responseType->expects($this->once())->method('setActive')->with(true);
170-
$responseType->expects($this->once())->method('setTokenType')->with('foo');
171-
$responseType->expects($this->once())->method('setToken')->with(['bar' => 'baz']);
172-
$responseType->expects($this->once())->method('generateHttpResponse')->with($response)->willReturnArgument(0);
169+
$responseType->expects(self::once())->method('setActive')->with(true);
170+
$responseType->expects(self::once())->method('setTokenType')->with('foo');
171+
$responseType->expects(self::once())->method('setToken')->with(['bar' => 'baz']);
172+
$responseType->expects(self::once())->method('generateHttpResponse')->with($response)->willReturnArgument(0);
173173

174174
$handler = $this->getMockBuilder(TokenIntrospectionHandler::class)->onlyMethods(['validateToken'])->getMock();
175175
$handler->setClientRepository($clientRepository);
176176
$handler->setResponseType($responseType);
177-
$handler->expects($this->once())
177+
$handler->expects(self::once())
178178
->method('validateToken')
179179
->with($request, $client)
180180
->willReturn(['foo', ['bar' => 'baz']]);

tests/Handlers/TokenRevocationHandlerTest.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ public function testRespondToRequestForAccessToken(): void
2222
$client->setIdentifier('client1');
2323

2424
$clientRepository = $this->createMock(ClientRepositoryInterface::class);
25-
$clientRepository->expects($this->once())
25+
$clientRepository->expects(self::once())
2626
->method('getClientEntity')
2727
->with('client1')
2828
->willReturn($client);
2929
$clientRepository
30-
->expects($this->once())
30+
->expects(self::once())
3131
->method('validateClient')
3232
->with('client1', 'secret1', null)
3333
->willReturn(true);
3434

3535
$accessTokenRepository = $this->createMock(AccessTokenRepositoryInterface::class);
36-
$accessTokenRepository->expects($this->once())->method('revokeAccessToken')->with('access1');
36+
$accessTokenRepository->expects(self::once())->method('revokeAccessToken')->with('access1');
3737

3838
$request = (new ServerRequest())->withParsedBody([
3939
'client_id' => 'client1',
@@ -44,7 +44,7 @@ public function testRespondToRequestForAccessToken(): void
4444
$handler = $this->getMockBuilder(TokenRevocationHandler::class)->onlyMethods(['validateAccessToken'])->getMock();
4545
$handler->setClientRepository($clientRepository);
4646
$handler->setAccessTokenRepository($accessTokenRepository);
47-
$handler->expects($this->once())
47+
$handler->expects(self::once())
4848
->method('validateAccessToken')
4949
->with($request, 'token1', $client)
5050
->willReturn(['access_token', ['jti' => 'access1']]);
@@ -62,21 +62,21 @@ public function testRespondToRequestForRefreshToken(): void
6262
$client->setIdentifier('client1');
6363

6464
$clientRepository = $this->createMock(ClientRepositoryInterface::class);
65-
$clientRepository->expects($this->once())
65+
$clientRepository->expects(self::once())
6666
->method('getClientEntity')
6767
->with('client1')
6868
->willReturn($client);
6969
$clientRepository
70-
->expects($this->once())
70+
->expects(self::once())
7171
->method('validateClient')
7272
->with('client1', 'secret1', null)
7373
->willReturn(true);
7474

7575
$accessTokenRepository = $this->createMock(AccessTokenRepositoryInterface::class);
76-
$accessTokenRepository->expects($this->once())->method('revokeAccessToken')->with('access1');
76+
$accessTokenRepository->expects(self::once())->method('revokeAccessToken')->with('access1');
7777

7878
$refreshTokenRepository = $this->createMock(RefreshTokenRepositoryInterface::class);
79-
$refreshTokenRepository->expects($this->once())->method('revokeRefreshToken')->with('refresh1');
79+
$refreshTokenRepository->expects(self::once())->method('revokeRefreshToken')->with('refresh1');
8080

8181
$request = (new ServerRequest())->withParsedBody([
8282
'client_id' => 'client1',
@@ -88,7 +88,7 @@ public function testRespondToRequestForRefreshToken(): void
8888
$handler->setClientRepository($clientRepository);
8989
$handler->setAccessTokenRepository($accessTokenRepository);
9090
$handler->setRefreshTokenRepository($refreshTokenRepository);
91-
$handler->expects($this->once())
91+
$handler->expects(self::once())
9292
->method('validateRefreshToken')
9393
->with($request, 'token1', $client)
9494
->willReturn(['refresh_token', ['refresh_token_id' => 'refresh1', 'access_token_id' => 'access1']]);
@@ -106,21 +106,21 @@ public function testRespondToRequestForInvalidToken(): void
106106
$client->setIdentifier('client1');
107107

108108
$clientRepository = $this->createMock(ClientRepositoryInterface::class);
109-
$clientRepository->expects($this->once())
109+
$clientRepository->expects(self::once())
110110
->method('getClientEntity')
111111
->with('client1')
112112
->willReturn($client);
113113
$clientRepository
114-
->expects($this->once())
114+
->expects(self::once())
115115
->method('validateClient')
116116
->with('client1', 'secret1', null)
117117
->willReturn(true);
118118

119119
$accessTokenRepository = $this->createMock(AccessTokenRepositoryInterface::class);
120-
$accessTokenRepository->expects($this->never())->method('revokeAccessToken');
120+
$accessTokenRepository->expects(self::never())->method('revokeAccessToken');
121121

122122
$refreshTokenRepository = $this->createMock(RefreshTokenRepositoryInterface::class);
123-
$refreshTokenRepository->expects($this->never())->method('revokeRefreshToken');
123+
$refreshTokenRepository->expects(self::never())->method('revokeRefreshToken');
124124

125125
$request = (new ServerRequest())->withParsedBody([
126126
'client_id' => 'client1',
@@ -133,11 +133,11 @@ public function testRespondToRequestForInvalidToken(): void
133133
$handler->setClientRepository($clientRepository);
134134
$handler->setAccessTokenRepository($accessTokenRepository);
135135
$handler->setRefreshTokenRepository($refreshTokenRepository);
136-
$handler->expects($this->once())
136+
$handler->expects(self::once())
137137
->method('validateAccessToken')
138138
->with($request, 'token1', $client)
139139
->willReturn(null);
140-
$handler->expects($this->once())
140+
$handler->expects(self::once())
141141
->method('validateRefreshToken')
142142
->with($request, 'token1', $client)
143143
->willReturn(null);

tests/ResponseTypes/IntrospectionResponseTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ public function testGenerateHttpResponseWithExtraParams(): void
114114
'scopes' => ['scope1', 'scope2'],
115115
'client_id' => 'client1',
116116
'jti' => null,
117-
'extension' => 'extension1'
117+
'extension' => 'extension1',
118118
]);
119119

120120
$response = $responseType->generateHttpResponse(new Response());
@@ -130,7 +130,7 @@ public function testGenerateHttpResponseWithExtraParams(): void
130130
'client_id' => 'client1',
131131
'token_type' => 'Bearer',
132132
'foo' => 'bar',
133-
'extended' => 'extension1'
133+
'extended' => 'extension1',
134134
], json_decode($response->getBody()->getContents(), true));
135135
}
136136
}

tests/TokenServerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testRespondToTokenRevocationRequest(): void
2727
$client->setIdentifier('foo');
2828

2929
$clientRepository = $this->createMock(ClientRepositoryInterface::class);
30-
$clientRepository->expects($this->once())->method('getClientEntity')
30+
$clientRepository->expects(self::once())->method('getClientEntity')
3131
->with('foo')
3232
->willReturn($client);
3333

@@ -50,7 +50,7 @@ public function testRespondToTokenIntrospectionRequest(): void
5050
$client->setIdentifier('foo');
5151

5252
$clientRepository = $this->createMock(ClientRepositoryInterface::class);
53-
$clientRepository->expects($this->once())->method('getClientEntity')
53+
$clientRepository->expects(self::once())->method('getClientEntity')
5454
->with('foo')
5555
->willReturn($client);
5656

@@ -78,7 +78,7 @@ public function testSetTokenRevocationHandler(): void
7878
$response = $this->createMock(ResponseInterface::class);
7979

8080
$revocationHandler = $this->getMockBuilder(TokenHandlerInterface::class)->getMock();
81-
$revocationHandler->expects($this->once())->method('respondToRequest')
81+
$revocationHandler->expects(self::once())->method('respondToRequest')
8282
->with($request, $response)
8383
->willReturn($response);
8484

@@ -97,7 +97,7 @@ public function testSetTokenIntrospectionHandler(): void
9797
$response = $this->createMock(ResponseInterface::class);
9898

9999
$introspectionHandler = $this->getMockBuilder(TokenHandlerInterface::class)->getMock();
100-
$introspectionHandler->expects($this->once())->method('respondToRequest')
100+
$introspectionHandler->expects(self::once())->method('respondToRequest')
101101
->with($request, $response)
102102
->willReturn($response);
103103

0 commit comments

Comments
 (0)