aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/api/ApiMiddlewareTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/api/ApiMiddlewareTest.php')
-rw-r--r--tests/api/ApiMiddlewareTest.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/api/ApiMiddlewareTest.php b/tests/api/ApiMiddlewareTest.php
index b157e4a7..7386e435 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 */
21class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase 21class 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
@@ -109,7 +109,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
109 $this->assertEquals(401, $response->getStatusCode()); 109 $this->assertEquals(401, $response->getStatusCode());
110 $body = json_decode((string) $response->getBody()); 110 $body = json_decode((string) $response->getBody());
111 $this->assertEquals('Not authorized: API is disabled', $body->message); 111 $this->assertEquals('Not authorized: API is disabled', $body->message);
112 $this->assertContains('ApiAuthorizationException', $body->stacktrace); 112 $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
113 } 113 }
114 114
115 /** 115 /**
@@ -132,7 +132,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
132 $this->assertEquals(401, $response->getStatusCode()); 132 $this->assertEquals(401, $response->getStatusCode());
133 $body = json_decode((string) $response->getBody()); 133 $body = json_decode((string) $response->getBody());
134 $this->assertEquals('Not authorized: JWT token not provided', $body->message); 134 $this->assertEquals('Not authorized: JWT token not provided', $body->message);
135 $this->assertContains('ApiAuthorizationException', $body->stacktrace); 135 $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
136 } 136 }
137 137
138 /** 138 /**
@@ -157,7 +157,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
157 $this->assertEquals(401, $response->getStatusCode()); 157 $this->assertEquals(401, $response->getStatusCode());
158 $body = json_decode((string) $response->getBody()); 158 $body = json_decode((string) $response->getBody());
159 $this->assertEquals('Not authorized: Token secret must be set in Shaarli\'s administration', $body->message); 159 $this->assertEquals('Not authorized: Token secret must be set in Shaarli\'s administration', $body->message);
160 $this->assertContains('ApiAuthorizationException', $body->stacktrace); 160 $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
161 } 161 }
162 162
163 /** 163 /**
@@ -180,7 +180,7 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
180 $this->assertEquals(401, $response->getStatusCode()); 180 $this->assertEquals(401, $response->getStatusCode());
181 $body = json_decode((string) $response->getBody()); 181 $body = json_decode((string) $response->getBody());
182 $this->assertEquals('Not authorized: Invalid JWT header', $body->message); 182 $this->assertEquals('Not authorized: Invalid JWT header', $body->message);
183 $this->assertContains('ApiAuthorizationException', $body->stacktrace); 183 $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
184 } 184 }
185 185
186 /** 186 /**
@@ -206,6 +206,6 @@ class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
206 $this->assertEquals(401, $response->getStatusCode()); 206 $this->assertEquals(401, $response->getStatusCode());
207 $body = json_decode((string) $response->getBody()); 207 $body = json_decode((string) $response->getBody());
208 $this->assertEquals('Not authorized: Malformed JWT token', $body->message); 208 $this->assertEquals('Not authorized: Malformed JWT token', $body->message);
209 $this->assertContains('ApiAuthorizationException', $body->stacktrace); 209 $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
210 } 210 }
211} 211}