mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Fix unit tests
This commit is contained in:
@@ -46,7 +46,6 @@ abstract class ApiAbstract extends \PhraseanetWebTestCaseAbstract
|
||||
*/
|
||||
protected static $adminApplication;
|
||||
protected static $databoxe_ids = array();
|
||||
protected static $useExceptionHandler = true;
|
||||
|
||||
abstract public function getParameters(array $parameters = array());
|
||||
|
||||
|
@@ -6,7 +6,12 @@ class AdminCollectionTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
protected $client;
|
||||
public static $createdCollections = array();
|
||||
protected static $useExceptionHandler = true;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
self::$DI['app.use-exception-handler'] = true;
|
||||
}
|
||||
|
||||
public function tearDown()
|
||||
{
|
||||
|
@@ -9,7 +9,12 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
public static $account = null;
|
||||
public static $api = null;
|
||||
protected $client;
|
||||
protected static $useExceptionHandler = true;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
self::$DI['app.use-exception-handler'] = true;
|
||||
}
|
||||
|
||||
public function testList()
|
||||
{
|
||||
@@ -31,12 +36,6 @@ class Module_Admin_Route_PublicationTest extends PhraseanetWebTestCaseAuthentica
|
||||
{
|
||||
$appbox = self::$DI['app']['phraseanet.appbox'];
|
||||
|
||||
// foreach ($appbox->get_databoxes() as $databox) {
|
||||
// foreach ($databox->get_collections() as $collection) {
|
||||
// $base_id = $collection->get_base_id();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
$feeds = Feed_Collection::load_all(self::$DI['app'], self::$DI['user']);
|
||||
$count = sizeof($feeds->get_feeds());
|
||||
|
||||
|
@@ -5,7 +5,6 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract.
|
||||
class MustacheLoaderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
{
|
||||
protected $client;
|
||||
protected static $useExceptionHandler = false;
|
||||
|
||||
public function testRouteSlash()
|
||||
{
|
||||
|
@@ -14,11 +14,11 @@ class UploadTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
||||
protected $client;
|
||||
protected $tmpFile;
|
||||
protected static $need_records = false;
|
||||
protected static $useExceptionHandler = false;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
self::$DI['app.use-exception-handler'] = true;
|
||||
$this->tmpFile = sys_get_temp_dir() . '/' . time() . mt_rand(1000, 9999) . '.jpg';
|
||||
copy(__DIR__ . '/../../../../testfiles/cestlafete.jpg', $this->tmpFile);
|
||||
}
|
||||
|
@@ -72,11 +72,11 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
protected static $feed_4_public_title = 'Feed 4 title';
|
||||
protected static $feed_4_public_subtitle = 'Feed 4 subtitle';
|
||||
protected $client;
|
||||
protected static $useExceptionHandler = true;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
parent::setUp();
|
||||
self::$DI['app.use-exception-handler'] = true;
|
||||
self::$feed = Feed_Adapter::create(self::$DI['app'], self::$DI['user'], 'title', 'subtitle');
|
||||
self::$publisher = Feed_Publisher_Adapter::getPublisher(self::$DI['app']['phraseanet.appbox'], self::$feed, self::$DI['user']);
|
||||
self::$entry = Feed_Entry_Adapter::create(self::$DI['app'], self::$feed, self::$publisher, 'title_entry', 'subtitle', 'hello', "test@mail.com");
|
||||
@@ -109,7 +109,9 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
copy(__DIR__ . '/../../../../db-ref.sqlite', '/tmp/db.sqlite');
|
||||
|
||||
$appbox = $application['phraseanet.appbox'];
|
||||
$this->authenticate($application);
|
||||
|
||||
$application['session']->clear();
|
||||
$application['session']->set('usr_id', self::$DI['user']->get_id());
|
||||
|
||||
self::$feed_1_private = Feed_Adapter::create($application, self::$DI['user'], self::$feed_1_private_title, self::$feed_1_private_subtitle);
|
||||
self::$feed_1_private->set_public(false);
|
||||
@@ -162,7 +164,7 @@ class ControllerRssFeedTest extends \PhraseanetWebTestCaseAbstract
|
||||
|
||||
self::$public_feeds = Feed_Collection::load_public_feeds($application);
|
||||
self::$private_feeds = Feed_Collection::load_all($application, self::$DI['user']);
|
||||
$application->closeAccount();
|
||||
$application['session']->clear();
|
||||
}
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
|
@@ -27,7 +27,6 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
protected static $testsTime = array();
|
||||
protected static $records;
|
||||
public static $recordsInitialized = false;
|
||||
protected static $useExceptionHandler = false;
|
||||
|
||||
/**
|
||||
* Tell if tables were updated with new schemas
|
||||
@@ -106,17 +105,21 @@ 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;
|
||||
|
||||
|
||||
self::$DI['app'] = self::$DI->share(function() {
|
||||
self::$DI['app'] = self::$DI->share(function($DI) {
|
||||
$environment = 'test';
|
||||
$app = require __DIR__ . '/../lib/Alchemy/Phrasea/Application/Root.php';
|
||||
|
||||
$app['debug'] = true;
|
||||
|
||||
unset($app['exception_handler']);
|
||||
if (!$DI['app.use-exception-handler']) {
|
||||
unset($app['exception_handler']);
|
||||
}
|
||||
|
||||
$app['EM'] = $app->share($app->extend('EM', function($em) {
|
||||
@unlink('/tmp/db.sqlite');
|
||||
|
Reference in New Issue
Block a user