mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
Fix unit tests
This commit is contained in:
@@ -100,8 +100,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
|
||||
parent::setUp();
|
||||
|
||||
self::$DI['app.use-exception-handler'] = false;
|
||||
|
||||
\PHPUnit_Framework_Error_Warning::$enabled = true;
|
||||
\PHPUnit_Framework_Error_Notice::$enabled = true;
|
||||
|
||||
@@ -112,10 +110,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
|
||||
$app['debug'] = true;
|
||||
|
||||
if (!$DI['app.use-exception-handler']) {
|
||||
unset($app['exception_handler']);
|
||||
}
|
||||
|
||||
$app['EM'] = $app->share($app->extend('EM', function($em) {
|
||||
@unlink('/tmp/db.sqlite');
|
||||
copy(__DIR__ . '/../db-ref.sqlite', '/tmp/db.sqlite');
|
||||
@@ -169,6 +163,25 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
set_time_limit(0);
|
||||
}
|
||||
|
||||
protected function assertForbiddenResponse(Response $response)
|
||||
{
|
||||
$this->assertEquals(403, $response->getStatusCode());
|
||||
$this->assertTrue(false !== stripos($response->getContent(), 'forbidden'));
|
||||
}
|
||||
|
||||
protected function assertBadResponse(Response $response)
|
||||
{
|
||||
$this->assertEquals(400, $response->getStatusCode());
|
||||
$this->assertTrue(false !== stripos($response->getContent(), 'bad request'));
|
||||
}
|
||||
|
||||
protected function assertNotFoundResponse(Response $response)
|
||||
{
|
||||
$this->assertEquals(404, $response->getStatusCode());
|
||||
$this->assertTrue(false !== stripos($response->getContent(), 'not found'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Insert fixture contained in the specified fixtureLoader
|
||||
* into sqlLite test temporary database
|
||||
|
Reference in New Issue
Block a user