diff --git a/tests/Alchemy/Phrasea/Application/ApiAbstract.inc b/tests/Alchemy/Phrasea/Application/ApiAbstract.inc index aee420ad1e..9007ec0dab 100644 --- a/tests/Alchemy/Phrasea/Application/ApiAbstract.inc +++ b/tests/Alchemy/Phrasea/Application/ApiAbstract.inc @@ -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()); diff --git a/tests/Alchemy/Phrasea/Controller/Admin/AdminCollectionTest.php b/tests/Alchemy/Phrasea/Controller/Admin/AdminCollectionTest.php index 98fddb62a3..20ca96dce4 100644 --- a/tests/Alchemy/Phrasea/Controller/Admin/AdminCollectionTest.php +++ b/tests/Alchemy/Phrasea/Controller/Admin/AdminCollectionTest.php @@ -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() { diff --git a/tests/Alchemy/Phrasea/Controller/Admin/PublicationTest.php b/tests/Alchemy/Phrasea/Controller/Admin/PublicationTest.php index c68140989c..76c16cdc8d 100644 --- a/tests/Alchemy/Phrasea/Controller/Admin/PublicationTest.php +++ b/tests/Alchemy/Phrasea/Controller/Admin/PublicationTest.php @@ -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()); diff --git a/tests/Alchemy/Phrasea/Controller/Prod/MustacheLoaderTest.php b/tests/Alchemy/Phrasea/Controller/Prod/MustacheLoaderTest.php index eed310e863..fec27984aa 100644 --- a/tests/Alchemy/Phrasea/Controller/Prod/MustacheLoaderTest.php +++ b/tests/Alchemy/Phrasea/Controller/Prod/MustacheLoaderTest.php @@ -5,7 +5,6 @@ require_once __DIR__ . '/../../../../PhraseanetWebTestCaseAuthenticatedAbstract. class MustacheLoaderTest extends \PhraseanetWebTestCaseAuthenticatedAbstract { protected $client; - protected static $useExceptionHandler = false; public function testRouteSlash() { diff --git a/tests/Alchemy/Phrasea/Controller/Prod/UploadTest.php b/tests/Alchemy/Phrasea/Controller/Prod/UploadTest.php index cfc66505dd..ea3aa0a6fc 100644 --- a/tests/Alchemy/Phrasea/Controller/Prod/UploadTest.php +++ b/tests/Alchemy/Phrasea/Controller/Prod/UploadTest.php @@ -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); } diff --git a/tests/Alchemy/Phrasea/Controller/Root/RSSFeedTest.php b/tests/Alchemy/Phrasea/Controller/Root/RSSFeedTest.php index f050f9e958..173fd35480 100644 --- a/tests/Alchemy/Phrasea/Controller/Root/RSSFeedTest.php +++ b/tests/Alchemy/Phrasea/Controller/Root/RSSFeedTest.php @@ -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() diff --git a/tests/PhraseanetPHPUnitAbstract.class.inc b/tests/PhraseanetPHPUnitAbstract.class.inc index 6aaaee3434..663f41f3ef 100644 --- a/tests/PhraseanetPHPUnitAbstract.class.inc +++ b/tests/PhraseanetPHPUnitAbstract.class.inc @@ -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');