Skip to content

Commit ae929e4

Browse files
committed
Fix unstable tests
1 parent 90d22d7 commit ae929e4

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

tests/Acceptance/TokenEndpointTest.php

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public function testSuccessfulClientCredentialsRequest(): void
4444
$jsonResponse = json_decode($response->getContent(), true);
4545

4646
$this->assertSame('Bearer', $jsonResponse['token_type']);
47-
$this->assertSame(3600, $jsonResponse['expires_in']);
47+
$this->assertLessThanOrEqual(3600, $jsonResponse['expires_in']);
48+
$this->assertGreaterThan(0, $jsonResponse['expires_in']);
4849
$this->assertNotEmpty($jsonResponse['access_token']);
4950
}
5051

@@ -73,7 +74,8 @@ public function testSuccessfulPasswordRequest(): void
7374
$jsonResponse = json_decode($response->getContent(), true);
7475

7576
$this->assertSame('Bearer', $jsonResponse['token_type']);
76-
$this->assertSame(3600, $jsonResponse['expires_in']);
77+
$this->assertLessThanOrEqual(3600, $jsonResponse['expires_in']);
78+
$this->assertGreaterThan(0, $jsonResponse['expires_in']);
7779
$this->assertNotEmpty($jsonResponse['access_token']);
7880
$this->assertNotEmpty($jsonResponse['refresh_token']);
7981
}
@@ -100,7 +102,8 @@ public function testSuccessfulRefreshTokenRequest(): void
100102
$jsonResponse = json_decode($response->getContent(), true);
101103

102104
$this->assertSame('Bearer', $jsonResponse['token_type']);
103-
$this->assertSame(3600, $jsonResponse['expires_in']);
105+
$this->assertLessThanOrEqual(3600, $jsonResponse['expires_in']);
106+
$this->assertGreaterThan(0, $jsonResponse['expires_in']);
104107
$this->assertNotEmpty($jsonResponse['access_token']);
105108
$this->assertNotEmpty($jsonResponse['refresh_token']);
106109
}
@@ -128,7 +131,8 @@ public function testSuccessfulAuthorizationCodeRequest(): void
128131
$jsonResponse = json_decode($response->getContent(), true);
129132

130133
$this->assertSame('Bearer', $jsonResponse['token_type']);
131-
$this->assertSame(3600, $jsonResponse['expires_in']);
134+
$this->assertLessThanOrEqual(3600, $jsonResponse['expires_in']);
135+
$this->assertGreaterThan(0, $jsonResponse['expires_in']);
132136
$this->assertNotEmpty($jsonResponse['access_token']);
133137
}
134138

@@ -154,7 +158,8 @@ public function testSuccessfulAuthorizationCodeRequestWithPublicClient(): void
154158
$jsonResponse = json_decode($response->getContent(), true);
155159

156160
$this->assertSame('Bearer', $jsonResponse['token_type']);
157-
$this->assertSame(3600, $jsonResponse['expires_in']);
161+
$this->assertLessThanOrEqual(3600, $jsonResponse['expires_in']);
162+
$this->assertGreaterThan(0, $jsonResponse['expires_in']);
158163
$this->assertNotEmpty($jsonResponse['access_token']);
159164
}
160165

0 commit comments

Comments
 (0)