diff options
Diffstat (limited to 'tests/api/ApiMiddlewareTest.php')
-rw-r--r-- | tests/api/ApiMiddlewareTest.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/api/ApiMiddlewareTest.php b/tests/api/ApiMiddlewareTest.php index 32031750..86700840 100644 --- a/tests/api/ApiMiddlewareTest.php +++ b/tests/api/ApiMiddlewareTest.php | |||
@@ -18,7 +18,7 @@ use Slim\Http\Response; | |||
18 | * | 18 | * |
19 | * @package Api | 19 | * @package Api |
20 | */ | 20 | */ |
21 | class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase | 21 | class ApiMiddlewareTest extends \Shaarli\TestCase |
22 | { | 22 | { |
23 | /** | 23 | /** |
24 | * @var string datastore to test write operations | 24 | * @var string datastore to test write operations |
@@ -26,7 +26,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase | |||
26 | protected static $testDatastore = 'sandbox/datastore.php'; | 26 | protected static $testDatastore = 'sandbox/datastore.php'; |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * @var \ConfigManager instance | 29 | * @var ConfigManager instance |
30 | */ | 30 | */ |
31 | protected $conf; | 31 | protected $conf; |
32 | 32 | ||
@@ -156,7 +156,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase | |||
156 | $this->assertEquals(401, $response->getStatusCode()); | 156 | $this->assertEquals(401, $response->getStatusCode()); |
157 | $body = json_decode((string) $response->getBody()); | 157 | $body = json_decode((string) $response->getBody()); |
158 | $this->assertEquals('Not authorized: API is disabled', $body->message); | 158 | $this->assertEquals('Not authorized: API is disabled', $body->message); |
159 | $this->assertContains('ApiAuthorizationException', $body->stacktrace); | 159 | $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace); |
160 | } | 160 | } |
161 | 161 | ||
162 | /** | 162 | /** |
@@ -179,7 +179,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase | |||
179 | $this->assertEquals(401, $response->getStatusCode()); | 179 | $this->assertEquals(401, $response->getStatusCode()); |
180 | $body = json_decode((string) $response->getBody()); | 180 | $body = json_decode((string) $response->getBody()); |
181 | $this->assertEquals('Not authorized: JWT token not provided', $body->message); | 181 | $this->assertEquals('Not authorized: JWT token not provided', $body->message); |
182 | $this->assertContains('ApiAuthorizationException', $body->stacktrace); | 182 | $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace); |
183 | } | 183 | } |
184 | 184 | ||
185 | /** | 185 | /** |
@@ -204,7 +204,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase | |||
204 | $this->assertEquals(401, $response->getStatusCode()); | 204 | $this->assertEquals(401, $response->getStatusCode()); |
205 | $body = json_decode((string) $response->getBody()); | 205 | $body = json_decode((string) $response->getBody()); |
206 | $this->assertEquals('Not authorized: Token secret must be set in Shaarli\'s administration', $body->message); | 206 | $this->assertEquals('Not authorized: Token secret must be set in Shaarli\'s administration', $body->message); |
207 | $this->assertContains('ApiAuthorizationException', $body->stacktrace); | 207 | $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace); |
208 | } | 208 | } |
209 | 209 | ||
210 | /** | 210 | /** |
@@ -227,7 +227,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase | |||
227 | $this->assertEquals(401, $response->getStatusCode()); | 227 | $this->assertEquals(401, $response->getStatusCode()); |
228 | $body = json_decode((string) $response->getBody()); | 228 | $body = json_decode((string) $response->getBody()); |
229 | $this->assertEquals('Not authorized: Invalid JWT header', $body->message); | 229 | $this->assertEquals('Not authorized: Invalid JWT header', $body->message); |
230 | $this->assertContains('ApiAuthorizationException', $body->stacktrace); | 230 | $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace); |
231 | } | 231 | } |
232 | 232 | ||
233 | /** | 233 | /** |
@@ -253,6 +253,6 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase | |||
253 | $this->assertEquals(401, $response->getStatusCode()); | 253 | $this->assertEquals(401, $response->getStatusCode()); |
254 | $body = json_decode((string) $response->getBody()); | 254 | $body = json_decode((string) $response->getBody()); |
255 | $this->assertEquals('Not authorized: Malformed JWT token', $body->message); | 255 | $this->assertEquals('Not authorized: Malformed JWT token', $body->message); |
256 | $this->assertContains('ApiAuthorizationException', $body->stacktrace); | 256 | $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace); |
257 | } | 257 | } |
258 | } | 258 | } |