From 4cdca486d86226d01a5c687f91ac735ad280dae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= Date: Wed, 1 Jul 2015 16:32:24 +0200 Subject: [PATCH] Add getApplication() method PhraseanetTestCase. --- .../Phrasea/Authentication/AuthenticatorTest.php | 4 ++-- tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php | 2 +- .../Command/Developper/Utils/GruntDriverTest.php | 2 +- .../Command/Developper/Utils/UglifyJsDriverTest.php | 2 +- .../Tests/Phrasea/Controller/Admin/DataboxTest.php | 5 +---- .../Tests/Phrasea/Controller/Prod/QueryTest.php | 5 +++-- .../Tests/Phrasea/Controller/Root/RootTest.php | 4 ++-- .../Core/Provider/FileServeServiceProviderTest.php | 2 +- .../Mail/MailInfoBridgeUploadFailedTest.php | 6 +++--- .../Notification/Mail/MailInfoNewOrderTest.php | 4 ++-- .../Mail/MailInfoNewPublicationTest.php | 6 +++--- .../Mail/MailInfoOrderCancelledTest.php | 6 +++--- .../Mail/MailInfoOrderDeliveredTest.php | 6 +++--- .../Notification/Mail/MailInfoPushReceivedTest.php | 6 +++--- .../Mail/MailInfoRecordQuarantinedTest.php | 2 +- .../Mail/MailInfoSomebodyAutoregisteredTest.php | 2 +- .../Mail/MailInfoUserRegisteredTest.php | 4 ++-- .../Mail/MailInfoValidationDoneTest.php | 6 +++--- .../Mail/MailInfoValidationReminderTest.php | 4 ++-- .../Mail/MailInfoValidationRequestTest.php | 6 +++--- .../Notification/Mail/MailRecordsExportTest.php | 2 +- .../Mail/MailRequestEmailConfirmationTest.php | 2 +- .../Mail/MailRequestEmailUpdateTest.php | 2 +- .../Mail/MailRequestPasswordSetupTest.php | 4 ++-- .../Mail/MailRequestPasswordUpdateTest.php | 4 ++-- .../Mail/MailSuccessAccessRequestTest.php | 2 +- .../MailSuccessEmailConfirmationRegisteredTest.php | 2 +- ...MailSuccessEmailConfirmationUnregisteredTest.php | 2 +- .../Mail/MailSuccessEmailUpdateTest.php | 2 +- .../Notification/Mail/MailSuccessFTPSenderTest.php | 4 ++-- .../Phrasea/Notification/Mail/MailTestCase.php | 5 ----- .../Phrasea/Notification/Mail/MailTestTest.php | 2 +- .../Vocabulary/ControlProvider/UserProviderTest.php | 2 +- tests/classes/Bridge/Api/AbstractTest.php | 2 +- tests/classes/PhraseanetAuthenticatedTestCase.php | 3 +-- .../classes/PhraseanetAuthenticatedWebTestCase.php | 13 +++++-------- tests/classes/PhraseanetTestCase.php | 8 ++++++++ tests/classes/patch/380alpha3bTest.php | 2 +- 38 files changed, 72 insertions(+), 75 deletions(-) diff --git a/tests/Alchemy/Tests/Phrasea/Authentication/AuthenticatorTest.php b/tests/Alchemy/Tests/Phrasea/Authentication/AuthenticatorTest.php index f8f3e38c28..bb70a0ab5e 100644 --- a/tests/Alchemy/Tests/Phrasea/Authentication/AuthenticatorTest.php +++ b/tests/Alchemy/Tests/Phrasea/Authentication/AuthenticatorTest.php @@ -202,7 +202,7 @@ class AuthenticatorTest extends \PhraseanetTestCase */ public function testCloseAccount() { - $app = self::$DI['app']; + $app = $this->getApplication(); $user = self::$DI['user']; $authenticator = new Authenticator($app, $app['browser'], $app['session'], $app['orm.em']); @@ -214,7 +214,7 @@ class AuthenticatorTest extends \PhraseanetTestCase public function testCloseAccountWhenNoSessionThrowsAnException() { - $app = self::$DI['app']; + $app = $this->getApplication(); $authenticator = new Authenticator($app, $app['browser'], $app['session'], $app['orm.em']); $this->setExpectedException('Alchemy\Phrasea\Exception\RuntimeException', 'No session to close.'); diff --git a/tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php b/tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php index 5821ca11d9..89aed867c3 100644 --- a/tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php +++ b/tests/Alchemy/Tests/Phrasea/Border/ManagerTest.php @@ -386,7 +386,7 @@ class ManagerTest extends \PhraseanetAuthenticatedWebTestCase $file->addAttribute(new Metadata($monoData)); $file->addAttribute(new Metadata($multiData)); - $application = self::$DI['app']; + $application = $this->getApplication(); $postProcess = function ($element, $visa, $code) use ($application) { $this->assertInstanceOf('\\Alchemy\Phrasea\Model\Entities\\LazaretFile', $element); diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php index 8ca362a4c9..963046a3d9 100644 --- a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php +++ b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/GruntDriverTest.php @@ -14,7 +14,7 @@ class GruntDriverTest extends \PhraseanetTestCase { public function testCreate() { - $app = self::$DI['app']; + $app = $this->getApplication(); $app->register(new CLIDriversServiceProvider()); $driver = GruntDriver::create(['grunt.binaries' => $app['driver.binary-finder']('grunt', 'grunt_binary')]); $this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\GruntDriver', $driver); diff --git a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php index a9efd4fd28..fedb166caf 100644 --- a/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php +++ b/tests/Alchemy/Tests/Phrasea/Command/Developper/Utils/UglifyJsDriverTest.php @@ -14,7 +14,7 @@ class UglifyJsDriverTest extends \PhraseanetTestCase { public function testCreate() { - $app = self::$DI['app']; + $app = $this->getApplication(); $app->register(new CLIDriversServiceProvider()); $driver = UglifyJsDriver::create(['uglifyjs.binaries' => $app['driver.binary-finder']('uglifyjs', 'uglifyjs_binary')]); $this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver', $driver); diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxTest.php index 24febf3050..715d0cd6e9 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Admin/DataboxTest.php @@ -21,10 +21,7 @@ class DataboxTest extends \PhraseanetAuthenticatedWebTestCase public function setUp() { parent::setUp(); - self::$DI['app'] = $this->loadApp(); - self::dropDatabase(); - parent::setUp(); - self::dropDatabase(); + $this->dropDatabase(); } public function tearDown() diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Prod/QueryTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Prod/QueryTest.php index e5c65d568d..10fe1f1d53 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Prod/QueryTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Prod/QueryTest.php @@ -42,11 +42,12 @@ class QueryTest extends \PhraseanetAuthenticatedWebTestCase */ public function testQueryAnswerTrain() { - $this->authenticate(self::$DI['app']); + $app = $this->getApplication(); + $this->authenticate($app); self::$DI['record_2']; $options = new SearchEngineOptions(); - $options->onCollections(self::$DI['app']->getAclForUser(self::$DI['app']->getAuthenticatedUser())->get_granted_base()); + $options->onCollections($app->getAclForUser($app->getAuthenticatedUser())->get_granted_base()); $serializedOptions = $options->serialize(); self::$DI['client']->request('POST', '/prod/query/answer-train/', [ diff --git a/tests/Alchemy/Tests/Phrasea/Controller/Root/RootTest.php b/tests/Alchemy/Tests/Phrasea/Controller/Root/RootTest.php index b999951a8a..caabf093cb 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/Root/RootTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/Root/RootTest.php @@ -88,7 +88,7 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase public function testNoPersistentCookie() { - $app = self::$DI['app']; + $app = $this->getApplication(); $this->logout($app); $boolean = false; @@ -107,7 +107,7 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase public function testPersistentCookie() { - $app = self::$DI['app']; + $app = $this->getApplication(); $this->logout(self::$DI['app']); $browser = $this->getMockBuilder('\Browser') diff --git a/tests/Alchemy/Tests/Phrasea/Core/Provider/FileServeServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/Provider/FileServeServiceProviderTest.php index 1f35ca17e9..ec58e23f35 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Provider/FileServeServiceProviderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Core/Provider/FileServeServiceProviderTest.php @@ -40,7 +40,7 @@ class FileServeServiceProviderTest extends ServiceProviderTestCase public function testMapping() { - $app = clone self::$DI['app']; + $app = clone $this->getApplication(); $app['root.path'] = __DIR__ . '/../../../../../..'; $app->register(new ConfigurationServiceProvider()); $app->register(new FileServeServiceProvider()); diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoBridgeUploadFailedTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoBridgeUploadFailedTest.php index da8f6ef420..004b5e6b77 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoBridgeUploadFailedTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoBridgeUploadFailedTest.php @@ -22,7 +22,7 @@ class MailInfoBridgeUploadFailedTest extends MailWithLinkTestCase public function testSHouldThrowALogicExceptionIfNoAdapterProvided() { $mail = MailInfoBridgeUploadFailed::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), @@ -43,7 +43,7 @@ class MailInfoBridgeUploadFailedTest extends MailWithLinkTestCase public function testSHouldThrowALogicExceptionIfNoReasonProvided() { $mail = MailInfoBridgeUploadFailed::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), @@ -71,7 +71,7 @@ class MailInfoBridgeUploadFailedTest extends MailWithLinkTestCase public function getMail() { $mail = MailInfoBridgeUploadFailed::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewOrderTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewOrderTest.php index 23645c9117..05eec5ca74 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewOrderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewOrderTest.php @@ -20,7 +20,7 @@ class MailInfoNewOrderTest extends MailTestCase public function testShouldThrowALogicExceptionIfNoUserProvided() { $mail = MailInfoNewOrder::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() @@ -37,7 +37,7 @@ class MailInfoNewOrderTest extends MailTestCase public function getMail() { $mail = MailInfoNewOrder::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewPublicationTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewPublicationTest.php index 315a7895d1..5ea8952a57 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewPublicationTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoNewPublicationTest.php @@ -22,7 +22,7 @@ class MailInfoNewPublicationTest extends MailWithLinkTestCase public function testShouldThrowALogicExceptionIfNoTitleProvided() { $mail = MailInfoNewPublication::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() @@ -48,7 +48,7 @@ class MailInfoNewPublicationTest extends MailWithLinkTestCase public function testShouldThrowALogicExceptionIfNoAuthorProvided() { $mail = MailInfoNewPublication::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() @@ -72,7 +72,7 @@ class MailInfoNewPublicationTest extends MailWithLinkTestCase public function getMail() { $mail = MailInfoNewPublication::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderCancelledTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderCancelledTest.php index 0d6d511b9a..5ac691be15 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderCancelledTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderCancelledTest.php @@ -25,7 +25,7 @@ class MailInfoOrderCancelledTest extends MailTestCase public function testShouldThrowALogicExceptionIfNoQuantityProvided() { $mail = MailInfoOrderCancelled::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() @@ -49,7 +49,7 @@ class MailInfoOrderCancelledTest extends MailTestCase public function testShouldThrowALogicExceptionIfNoDelivererProvided() { $mail = MailInfoOrderCancelled::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() @@ -68,7 +68,7 @@ class MailInfoOrderCancelledTest extends MailTestCase public function getMail() { $mail = MailInfoOrderCancelled::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderDeliveredTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderDeliveredTest.php index f21580ff06..a9bf7018f4 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderDeliveredTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoOrderDeliveredTest.php @@ -25,7 +25,7 @@ class MailInfoOrderDeliveredTest extends MailTestCase public function testShouldThrowALogicExceptionIfNoDelivererProvided() { $mail = MailInfoOrderDelivered::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() @@ -49,7 +49,7 @@ class MailInfoOrderDeliveredTest extends MailTestCase public function testShouldThrowALogicExceptionIfNoBasketProvided() { $mail = MailInfoOrderDelivered::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() @@ -74,7 +74,7 @@ class MailInfoOrderDeliveredTest extends MailTestCase public function getMail() { $mail = MailInfoOrderDelivered::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoPushReceivedTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoPushReceivedTest.php index 64c92fd02c..467634afaa 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoPushReceivedTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoPushReceivedTest.php @@ -22,7 +22,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase public function testShouldThrowLogicExceptionsIfBasketNotSet() { $mail = MailInfoPushReceived::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), @@ -56,7 +56,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase public function testShouldThrowLogicExceptionsIfPusherNotSet() { $mail = MailInfoPushReceived::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), @@ -89,7 +89,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase public function getMail() { $mail = MailInfoPushReceived::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoRecordQuarantinedTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoRecordQuarantinedTest.php index d551bcf610..3c2d8c4abb 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoRecordQuarantinedTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoRecordQuarantinedTest.php @@ -14,7 +14,7 @@ class MailInfoRecordQuarantinedTest extends MailTestCase public function getMail() { return MailInfoRecordQuarantined::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoSomebodyAutoregisteredTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoSomebodyAutoregisteredTest.php index d5fd05f1cd..26d972cafa 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoSomebodyAutoregisteredTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoSomebodyAutoregisteredTest.php @@ -14,7 +14,7 @@ class MailInfoSomebodyAutoregisteredTest extends MailWithLinkTestCase public function getMail() { return MailInfoSomebodyAutoregistered::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoUserRegisteredTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoUserRegisteredTest.php index 15440ee7cd..ccb2ec3abc 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoUserRegisteredTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoUserRegisteredTest.php @@ -25,7 +25,7 @@ class MailInfoUserRegisteredTest extends MailTestCase public function testGetMessageWithoutRegisteredUserShouldThrowALogicException() { $mail = MailInfoUserRegistered::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() @@ -42,7 +42,7 @@ class MailInfoUserRegisteredTest extends MailTestCase public function getMail() { $mail = MailInfoUserRegistered::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationDoneTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationDoneTest.php index 2be986d8c1..04e920606f 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationDoneTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationDoneTest.php @@ -32,7 +32,7 @@ class MailInfoValidationDoneTest extends MailWithLinkTestCase public function testShouldThrowALogicExceptionIfNoTitleProvided() { $mail = MailInfoValidationDone::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), @@ -59,7 +59,7 @@ class MailInfoValidationDoneTest extends MailWithLinkTestCase public function testShouldThrowALogicExceptionIfNoUserProvided() { $mail = MailInfoValidationDone::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), @@ -87,7 +87,7 @@ class MailInfoValidationDoneTest extends MailWithLinkTestCase public function getMail() { $mail = MailInfoValidationDone::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationReminderTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationReminderTest.php index a720b87280..974755554d 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationReminderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationReminderTest.php @@ -23,7 +23,7 @@ class MailInfoValidationReminderTest extends MailWithLinkTestCase public function testShouldThrowALogicExceptionIfNoTitleProvided() { $mail = MailInfoValidationReminder::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() @@ -40,7 +40,7 @@ class MailInfoValidationReminderTest extends MailWithLinkTestCase public function getMail() { $mail = MailInfoValidationReminder::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationRequestTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationRequestTest.php index 713ac807fc..9c4ea8b909 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationRequestTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailInfoValidationRequestTest.php @@ -20,7 +20,7 @@ class MailInfoValidationRequestTest extends MailWithLinkTestCase public function testShouldThrowALogicExceptionIfNoUserProvided() { $mail = MailInfoValidationRequest::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), @@ -41,7 +41,7 @@ class MailInfoValidationRequestTest extends MailWithLinkTestCase public function testShouldThrowALogicExceptionIfNoTitleProvided() { $mail = MailInfoValidationRequest::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), @@ -73,7 +73,7 @@ class MailInfoValidationRequestTest extends MailWithLinkTestCase public function getMail() { $mail = MailInfoValidationRequest::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRecordsExportTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRecordsExportTest.php index 6bf465c873..bd07e36317 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRecordsExportTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRecordsExportTest.php @@ -14,7 +14,7 @@ class MailRecordsExportTest extends MailWithLinkTestCase public function getMail() { return MailRecordsExport::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestEmailConfirmationTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestEmailConfirmationTest.php index caea32ef08..2ce77920f6 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestEmailConfirmationTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestEmailConfirmationTest.php @@ -14,7 +14,7 @@ class MailRequestEmailConfirmationTest extends MailWithLinkTestCase public function getMail() { return MailRequestEmailConfirmation::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestEmailUpdateTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestEmailUpdateTest.php index b53b5789dd..90b1fae0a2 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestEmailUpdateTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestEmailUpdateTest.php @@ -14,7 +14,7 @@ class MailRequestEmailUpdateTest extends MailWithLinkTestCase public function getMail() { return MailRequestEmailUpdate::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordSetupTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordSetupTest.php index 3867c036a1..a4ab06bca9 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordSetupTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordSetupTest.php @@ -21,7 +21,7 @@ class MailRequestPasswordSetupTest extends MailWithLinkTestCase public function testThatALogicExceptionIsThrownIfNoLoginProvided() { $mail = MailRequestPasswordSetup::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), @@ -40,7 +40,7 @@ class MailRequestPasswordSetupTest extends MailWithLinkTestCase public function getMail() { $mail = MailRequestPasswordSetup::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php index 33e564a7a7..883739fef0 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php @@ -21,7 +21,7 @@ class MailRequestPasswordUpdateTest extends MailWithLinkTestCase public function getMail() { $mail = MailRequestPasswordUpdate::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), @@ -37,7 +37,7 @@ class MailRequestPasswordUpdateTest extends MailWithLinkTestCase public function testThatALogicExceptionIsThrownIfNoLoginProvided() { $mail = MailRequestPasswordUpdate::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessAccessRequestTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessAccessRequestTest.php index 71d41795f1..641c4d0db6 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessAccessRequestTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessAccessRequestTest.php @@ -14,7 +14,7 @@ class MailSuccessAccessRequestTest extends MailWithLinkTestCase public function getMail() { return MailSuccessAccessRequest::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailConfirmationRegisteredTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailConfirmationRegisteredTest.php index b9b8abc620..9196d2a193 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailConfirmationRegisteredTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailConfirmationRegisteredTest.php @@ -14,7 +14,7 @@ class MailSuccessEmailConfirmationRegisteredTest extends MailWithLinkTestCase public function getMail() { return MailSuccessEmailConfirmationRegistered::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailConfirmationUnregisteredTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailConfirmationUnregisteredTest.php index 5bb54fa1cd..7d8b4d21d2 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailConfirmationUnregisteredTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailConfirmationUnregisteredTest.php @@ -14,7 +14,7 @@ class MailSuccessEmailConfirmationUnregisteredTest extends MailWithLinkTestCase public function getMail() { return MailSuccessEmailConfirmationUnregistered::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage(), diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailUpdateTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailUpdateTest.php index 065515d8e4..a8e27ac2d7 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailUpdateTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessEmailUpdateTest.php @@ -14,7 +14,7 @@ class MailSuccessEmailUpdateTest extends MailTestCase public function getMail() { return MailSuccessEmailUpdate::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php index 4afe0a8349..e0602a3a83 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailSuccessFTPSenderTest.php @@ -20,7 +20,7 @@ class MailSuccessFTPSenderTest extends MailTestCase public function testThatALgicExceptionIsThrownIfNoServerSet() { $mail = MailSuccessFTPSender::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() @@ -37,7 +37,7 @@ class MailSuccessFTPSenderTest extends MailTestCase public function getMail() { $mail = MailSuccessFTPSender::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestCase.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestCase.php index 26844b725f..81431f4158 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestCase.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestCase.php @@ -34,11 +34,6 @@ abstract class MailTestCase extends \PhraseanetTestCase $this->assertTrue(0 === stripos($this->getMail()->getButtonURL(), 'http://'), 'Checking that URL button points to an absolute URL'); } - public function getApp() - { - return self::$DI['app']; - } - public function getReceiverMock() { return $this->getMock('Alchemy\Phrasea\Notification\ReceiverInterface'); diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestTest.php index 36fe5d7cd2..bfcd7dcd93 100644 --- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestTest.php +++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailTestTest.php @@ -14,7 +14,7 @@ class MailTestTest extends MailTestCase public function getMail() { return MailTest::create( - $this->getApp(), + $this->getApplication(), $this->getReceiverMock(), $this->getEmitterMock(), $this->getMessage() diff --git a/tests/Alchemy/Tests/Phrasea/Vocabulary/ControlProvider/UserProviderTest.php b/tests/Alchemy/Tests/Phrasea/Vocabulary/ControlProvider/UserProviderTest.php index 0b9dcbcda6..6dd28f28c8 100644 --- a/tests/Alchemy/Tests/Phrasea/Vocabulary/ControlProvider/UserProviderTest.php +++ b/tests/Alchemy/Tests/Phrasea/Vocabulary/ControlProvider/UserProviderTest.php @@ -47,7 +47,7 @@ class UserProviderTest extends \PhraseanetTestCase // mandatory until user rights are managed by doctrine //self::$DI['app']['orm.em'] = EntityManager::create(self::$DI['app']['conf']->get(['main', 'database']), self::$DI['app']['db.config'], self::$DI['app']['db.event_manager']); - $app = self::$DI['app']; + $app = $this->getApplication(); $params = $app['db.appbox.info']; $info = $app['db.info']($params); $key = $app['orm.add']($info); diff --git a/tests/classes/Bridge/Api/AbstractTest.php b/tests/classes/Bridge/Api/AbstractTest.php index 31e571a497..5cd7551272 100644 --- a/tests/classes/Bridge/Api/AbstractTest.php +++ b/tests/classes/Bridge/Api/AbstractTest.php @@ -27,7 +27,7 @@ class Bridge_Api_AbstractTest extends \PhraseanetWebTestCase $this->bridgeApi = $this->getMock('Bridge_Api_Abstract', ["is_configured", "initialize_transport", "set_auth_params", "set_transport_authentication_params"], [self::$DI['app']['url_generator'], self::$DI['app']['conf'], $this->auth, self::$DI['app']['translator']]); if (!self::$api) { - $application = self::$DI['app']; + $application = $this->getApplication(); try { self::$api = Bridge_Api::get_by_api_name($application, 'apitest'); } catch (Bridge_Exception_ApiNotFound $e) { diff --git a/tests/classes/PhraseanetAuthenticatedTestCase.php b/tests/classes/PhraseanetAuthenticatedTestCase.php index 6882b10668..0877345ad0 100644 --- a/tests/classes/PhraseanetAuthenticatedTestCase.php +++ b/tests/classes/PhraseanetAuthenticatedTestCase.php @@ -36,8 +36,7 @@ abstract class PhraseanetAuthenticatedTestCase extends \PhraseanetTestCase ->method('get') ->will($this->returnValue($stubbedACL)); - /** @var \Alchemy\Phrasea\Application $app */ - $app = self::$DI['app']; + $app = $this->getApplication(); $app['acl'] = $aclProvider; $app->setAclProvider($aclProvider); diff --git a/tests/classes/PhraseanetAuthenticatedWebTestCase.php b/tests/classes/PhraseanetAuthenticatedWebTestCase.php index 774019bb7b..9bc361a9ec 100644 --- a/tests/classes/PhraseanetAuthenticatedWebTestCase.php +++ b/tests/classes/PhraseanetAuthenticatedWebTestCase.php @@ -78,8 +78,7 @@ abstract class PhraseanetAuthenticatedWebTestCase extends \PhraseanetAuthenticat { $this->createDatabase(); - /** @var Application $app */ - $app = self::$DI['app']; + $app = $this->getApplication(); $info = $app['phraseanet.configuration']['main']['database']; try { @@ -117,10 +116,9 @@ abstract class PhraseanetAuthenticatedWebTestCase extends \PhraseanetAuthenticat return $databox; } - public static function dropDatabase() + public function dropDatabase() { - /** @var Application $app */ - $app = self::$DI['app']; + $app = $this->getApplication(); $connection = $app->getApplicationBox()->get_connection(); $stmt = $connection->prepare('DROP DATABASE IF EXISTS `unit_test_db`'); $stmt->execute(); @@ -132,10 +130,9 @@ abstract class PhraseanetAuthenticatedWebTestCase extends \PhraseanetAuthenticat protected function createDatabase() { - self::dropDatabase(); + $this->dropDatabase(); - /** @var Application $app */ - $app = self::$DI['app']; + $app = $this->getApplication(); $stmt = $app ->getApplicationBox() ->get_connection() diff --git a/tests/classes/PhraseanetTestCase.php b/tests/classes/PhraseanetTestCase.php index 83702557e0..1b10758eb4 100644 --- a/tests/classes/PhraseanetTestCase.php +++ b/tests/classes/PhraseanetTestCase.php @@ -271,6 +271,14 @@ abstract class PhraseanetTestCase extends WebTestCase self::$fixtureIds = $decodedFixtureIds; } + /** + * @return Application + */ + public function getApplication() + { + return self::$DI['app']; + } + public static function tearDownAfterClass() { gc_collect_cycles(); diff --git a/tests/classes/patch/380alpha3bTest.php b/tests/classes/patch/380alpha3bTest.php index 8892256c32..b09f3c4348 100644 --- a/tests/classes/patch/380alpha3bTest.php +++ b/tests/classes/patch/380alpha3bTest.php @@ -17,7 +17,7 @@ class patch_380alpha3bTest extends \PhraseanetTestCase ->disableOriginalConstructor() ->getMock(); - $app = self::$DI['app']; + $app = $this->getApplication(); $app['conf'] = $this->getMockBuilder('Alchemy\Phrasea\Core\Configuration\PropertyAccess') ->disableOriginalConstructor()