*
* @package Api
*/
-class ApiMiddlewareTest extends \PHPUnit\Framework\TestCase
+class ApiMiddlewareTest extends \Shaarli\TestCase
{
/**
* @var string datastore to test write operations
protected static $testDatastore = 'sandbox/datastore.php';
/**
- * @var \ConfigManager instance
+ * @var ConfigManager instance
*/
protected $conf;
$this->assertEquals(401, $response->getStatusCode());
$body = json_decode((string) $response->getBody());
$this->assertEquals('Not authorized: API is disabled', $body->message);
- $this->assertContains('ApiAuthorizationException', $body->stacktrace);
+ $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
}
/**
$this->assertEquals(401, $response->getStatusCode());
$body = json_decode((string) $response->getBody());
$this->assertEquals('Not authorized: JWT token not provided', $body->message);
- $this->assertContains('ApiAuthorizationException', $body->stacktrace);
+ $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
}
/**
$this->assertEquals(401, $response->getStatusCode());
$body = json_decode((string) $response->getBody());
$this->assertEquals('Not authorized: Token secret must be set in Shaarli\'s administration', $body->message);
- $this->assertContains('ApiAuthorizationException', $body->stacktrace);
+ $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
}
/**
$this->assertEquals(401, $response->getStatusCode());
$body = json_decode((string) $response->getBody());
$this->assertEquals('Not authorized: Invalid JWT header', $body->message);
- $this->assertContains('ApiAuthorizationException', $body->stacktrace);
+ $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
}
/**
$this->assertEquals(401, $response->getStatusCode());
$body = json_decode((string) $response->getBody());
$this->assertEquals('Not authorized: Malformed JWT token', $body->message);
- $this->assertContains('ApiAuthorizationException', $body->stacktrace);
+ $this->assertContainsPolyfill('ApiAuthorizationException', $body->stacktrace);
}
}