Add getApplication() method PhraseanetTestCase.

This commit is contained in:
Benoît Burnichon
2015-07-01 16:32:24 +02:00
parent a9160d62f6
commit 4cdca486d8
38 changed files with 72 additions and 75 deletions

View File

@@ -202,7 +202,7 @@ class AuthenticatorTest extends \PhraseanetTestCase
*/ */
public function testCloseAccount() public function testCloseAccount()
{ {
$app = self::$DI['app']; $app = $this->getApplication();
$user = self::$DI['user']; $user = self::$DI['user'];
$authenticator = new Authenticator($app, $app['browser'], $app['session'], $app['orm.em']); $authenticator = new Authenticator($app, $app['browser'], $app['session'], $app['orm.em']);
@@ -214,7 +214,7 @@ class AuthenticatorTest extends \PhraseanetTestCase
public function testCloseAccountWhenNoSessionThrowsAnException() public function testCloseAccountWhenNoSessionThrowsAnException()
{ {
$app = self::$DI['app']; $app = $this->getApplication();
$authenticator = new Authenticator($app, $app['browser'], $app['session'], $app['orm.em']); $authenticator = new Authenticator($app, $app['browser'], $app['session'], $app['orm.em']);
$this->setExpectedException('Alchemy\Phrasea\Exception\RuntimeException', 'No session to close.'); $this->setExpectedException('Alchemy\Phrasea\Exception\RuntimeException', 'No session to close.');

View File

@@ -386,7 +386,7 @@ class ManagerTest extends \PhraseanetAuthenticatedWebTestCase
$file->addAttribute(new Metadata($monoData)); $file->addAttribute(new Metadata($monoData));
$file->addAttribute(new Metadata($multiData)); $file->addAttribute(new Metadata($multiData));
$application = self::$DI['app']; $application = $this->getApplication();
$postProcess = function ($element, $visa, $code) use ($application) { $postProcess = function ($element, $visa, $code) use ($application) {
$this->assertInstanceOf('\\Alchemy\Phrasea\Model\Entities\\LazaretFile', $element); $this->assertInstanceOf('\\Alchemy\Phrasea\Model\Entities\\LazaretFile', $element);

View File

@@ -14,7 +14,7 @@ class GruntDriverTest extends \PhraseanetTestCase
{ {
public function testCreate() public function testCreate()
{ {
$app = self::$DI['app']; $app = $this->getApplication();
$app->register(new CLIDriversServiceProvider()); $app->register(new CLIDriversServiceProvider());
$driver = GruntDriver::create(['grunt.binaries' => $app['driver.binary-finder']('grunt', 'grunt_binary')]); $driver = GruntDriver::create(['grunt.binaries' => $app['driver.binary-finder']('grunt', 'grunt_binary')]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\GruntDriver', $driver); $this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\GruntDriver', $driver);

View File

@@ -14,7 +14,7 @@ class UglifyJsDriverTest extends \PhraseanetTestCase
{ {
public function testCreate() public function testCreate()
{ {
$app = self::$DI['app']; $app = $this->getApplication();
$app->register(new CLIDriversServiceProvider()); $app->register(new CLIDriversServiceProvider());
$driver = UglifyJsDriver::create(['uglifyjs.binaries' => $app['driver.binary-finder']('uglifyjs', 'uglifyjs_binary')]); $driver = UglifyJsDriver::create(['uglifyjs.binaries' => $app['driver.binary-finder']('uglifyjs', 'uglifyjs_binary')]);
$this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver', $driver); $this->assertInstanceOf('Alchemy\Phrasea\Command\Developer\Utils\UglifyJsDriver', $driver);

View File

@@ -21,10 +21,7 @@ class DataboxTest extends \PhraseanetAuthenticatedWebTestCase
public function setUp() public function setUp()
{ {
parent::setUp(); parent::setUp();
self::$DI['app'] = $this->loadApp(); $this->dropDatabase();
self::dropDatabase();
parent::setUp();
self::dropDatabase();
} }
public function tearDown() public function tearDown()

View File

@@ -42,11 +42,12 @@ class QueryTest extends \PhraseanetAuthenticatedWebTestCase
*/ */
public function testQueryAnswerTrain() public function testQueryAnswerTrain()
{ {
$this->authenticate(self::$DI['app']); $app = $this->getApplication();
$this->authenticate($app);
self::$DI['record_2']; self::$DI['record_2'];
$options = new SearchEngineOptions(); $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(); $serializedOptions = $options->serialize();
self::$DI['client']->request('POST', '/prod/query/answer-train/', [ self::$DI['client']->request('POST', '/prod/query/answer-train/', [

View File

@@ -88,7 +88,7 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testNoPersistentCookie() public function testNoPersistentCookie()
{ {
$app = self::$DI['app']; $app = $this->getApplication();
$this->logout($app); $this->logout($app);
$boolean = false; $boolean = false;
@@ -107,7 +107,7 @@ class RootTest extends \PhraseanetAuthenticatedWebTestCase
public function testPersistentCookie() public function testPersistentCookie()
{ {
$app = self::$DI['app']; $app = $this->getApplication();
$this->logout(self::$DI['app']); $this->logout(self::$DI['app']);
$browser = $this->getMockBuilder('\Browser') $browser = $this->getMockBuilder('\Browser')

View File

@@ -40,7 +40,7 @@ class FileServeServiceProviderTest extends ServiceProviderTestCase
public function testMapping() public function testMapping()
{ {
$app = clone self::$DI['app']; $app = clone $this->getApplication();
$app['root.path'] = __DIR__ . '/../../../../../..'; $app['root.path'] = __DIR__ . '/../../../../../..';
$app->register(new ConfigurationServiceProvider()); $app->register(new ConfigurationServiceProvider());
$app->register(new FileServeServiceProvider()); $app->register(new FileServeServiceProvider());

View File

@@ -22,7 +22,7 @@ class MailInfoBridgeUploadFailedTest extends MailWithLinkTestCase
public function testSHouldThrowALogicExceptionIfNoAdapterProvided() public function testSHouldThrowALogicExceptionIfNoAdapterProvided()
{ {
$mail = MailInfoBridgeUploadFailed::create( $mail = MailInfoBridgeUploadFailed::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),
@@ -43,7 +43,7 @@ class MailInfoBridgeUploadFailedTest extends MailWithLinkTestCase
public function testSHouldThrowALogicExceptionIfNoReasonProvided() public function testSHouldThrowALogicExceptionIfNoReasonProvided()
{ {
$mail = MailInfoBridgeUploadFailed::create( $mail = MailInfoBridgeUploadFailed::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),
@@ -71,7 +71,7 @@ class MailInfoBridgeUploadFailedTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
$mail = MailInfoBridgeUploadFailed::create( $mail = MailInfoBridgeUploadFailed::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -20,7 +20,7 @@ class MailInfoNewOrderTest extends MailTestCase
public function testShouldThrowALogicExceptionIfNoUserProvided() public function testShouldThrowALogicExceptionIfNoUserProvided()
{ {
$mail = MailInfoNewOrder::create( $mail = MailInfoNewOrder::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()
@@ -37,7 +37,7 @@ class MailInfoNewOrderTest extends MailTestCase
public function getMail() public function getMail()
{ {
$mail = MailInfoNewOrder::create( $mail = MailInfoNewOrder::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()

View File

@@ -22,7 +22,7 @@ class MailInfoNewPublicationTest extends MailWithLinkTestCase
public function testShouldThrowALogicExceptionIfNoTitleProvided() public function testShouldThrowALogicExceptionIfNoTitleProvided()
{ {
$mail = MailInfoNewPublication::create( $mail = MailInfoNewPublication::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()
@@ -48,7 +48,7 @@ class MailInfoNewPublicationTest extends MailWithLinkTestCase
public function testShouldThrowALogicExceptionIfNoAuthorProvided() public function testShouldThrowALogicExceptionIfNoAuthorProvided()
{ {
$mail = MailInfoNewPublication::create( $mail = MailInfoNewPublication::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()
@@ -72,7 +72,7 @@ class MailInfoNewPublicationTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
$mail = MailInfoNewPublication::create( $mail = MailInfoNewPublication::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -25,7 +25,7 @@ class MailInfoOrderCancelledTest extends MailTestCase
public function testShouldThrowALogicExceptionIfNoQuantityProvided() public function testShouldThrowALogicExceptionIfNoQuantityProvided()
{ {
$mail = MailInfoOrderCancelled::create( $mail = MailInfoOrderCancelled::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()
@@ -49,7 +49,7 @@ class MailInfoOrderCancelledTest extends MailTestCase
public function testShouldThrowALogicExceptionIfNoDelivererProvided() public function testShouldThrowALogicExceptionIfNoDelivererProvided()
{ {
$mail = MailInfoOrderCancelled::create( $mail = MailInfoOrderCancelled::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()
@@ -68,7 +68,7 @@ class MailInfoOrderCancelledTest extends MailTestCase
public function getMail() public function getMail()
{ {
$mail = MailInfoOrderCancelled::create( $mail = MailInfoOrderCancelled::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()

View File

@@ -25,7 +25,7 @@ class MailInfoOrderDeliveredTest extends MailTestCase
public function testShouldThrowALogicExceptionIfNoDelivererProvided() public function testShouldThrowALogicExceptionIfNoDelivererProvided()
{ {
$mail = MailInfoOrderDelivered::create( $mail = MailInfoOrderDelivered::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()
@@ -49,7 +49,7 @@ class MailInfoOrderDeliveredTest extends MailTestCase
public function testShouldThrowALogicExceptionIfNoBasketProvided() public function testShouldThrowALogicExceptionIfNoBasketProvided()
{ {
$mail = MailInfoOrderDelivered::create( $mail = MailInfoOrderDelivered::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()
@@ -74,7 +74,7 @@ class MailInfoOrderDeliveredTest extends MailTestCase
public function getMail() public function getMail()
{ {
$mail = MailInfoOrderDelivered::create( $mail = MailInfoOrderDelivered::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()

View File

@@ -22,7 +22,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase
public function testShouldThrowLogicExceptionsIfBasketNotSet() public function testShouldThrowLogicExceptionsIfBasketNotSet()
{ {
$mail = MailInfoPushReceived::create( $mail = MailInfoPushReceived::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),
@@ -56,7 +56,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase
public function testShouldThrowLogicExceptionsIfPusherNotSet() public function testShouldThrowLogicExceptionsIfPusherNotSet()
{ {
$mail = MailInfoPushReceived::create( $mail = MailInfoPushReceived::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),
@@ -89,7 +89,7 @@ class MailInfoPushReceivedTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
$mail = MailInfoPushReceived::create( $mail = MailInfoPushReceived::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -14,7 +14,7 @@ class MailInfoRecordQuarantinedTest extends MailTestCase
public function getMail() public function getMail()
{ {
return MailInfoRecordQuarantined::create( return MailInfoRecordQuarantined::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()

View File

@@ -14,7 +14,7 @@ class MailInfoSomebodyAutoregisteredTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
return MailInfoSomebodyAutoregistered::create( return MailInfoSomebodyAutoregistered::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -25,7 +25,7 @@ class MailInfoUserRegisteredTest extends MailTestCase
public function testGetMessageWithoutRegisteredUserShouldThrowALogicException() public function testGetMessageWithoutRegisteredUserShouldThrowALogicException()
{ {
$mail = MailInfoUserRegistered::create( $mail = MailInfoUserRegistered::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()
@@ -42,7 +42,7 @@ class MailInfoUserRegisteredTest extends MailTestCase
public function getMail() public function getMail()
{ {
$mail = MailInfoUserRegistered::create( $mail = MailInfoUserRegistered::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()

View File

@@ -32,7 +32,7 @@ class MailInfoValidationDoneTest extends MailWithLinkTestCase
public function testShouldThrowALogicExceptionIfNoTitleProvided() public function testShouldThrowALogicExceptionIfNoTitleProvided()
{ {
$mail = MailInfoValidationDone::create( $mail = MailInfoValidationDone::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),
@@ -59,7 +59,7 @@ class MailInfoValidationDoneTest extends MailWithLinkTestCase
public function testShouldThrowALogicExceptionIfNoUserProvided() public function testShouldThrowALogicExceptionIfNoUserProvided()
{ {
$mail = MailInfoValidationDone::create( $mail = MailInfoValidationDone::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),
@@ -87,7 +87,7 @@ class MailInfoValidationDoneTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
$mail = MailInfoValidationDone::create( $mail = MailInfoValidationDone::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -23,7 +23,7 @@ class MailInfoValidationReminderTest extends MailWithLinkTestCase
public function testShouldThrowALogicExceptionIfNoTitleProvided() public function testShouldThrowALogicExceptionIfNoTitleProvided()
{ {
$mail = MailInfoValidationReminder::create( $mail = MailInfoValidationReminder::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()
@@ -40,7 +40,7 @@ class MailInfoValidationReminderTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
$mail = MailInfoValidationReminder::create( $mail = MailInfoValidationReminder::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -20,7 +20,7 @@ class MailInfoValidationRequestTest extends MailWithLinkTestCase
public function testShouldThrowALogicExceptionIfNoUserProvided() public function testShouldThrowALogicExceptionIfNoUserProvided()
{ {
$mail = MailInfoValidationRequest::create( $mail = MailInfoValidationRequest::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),
@@ -41,7 +41,7 @@ class MailInfoValidationRequestTest extends MailWithLinkTestCase
public function testShouldThrowALogicExceptionIfNoTitleProvided() public function testShouldThrowALogicExceptionIfNoTitleProvided()
{ {
$mail = MailInfoValidationRequest::create( $mail = MailInfoValidationRequest::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),
@@ -73,7 +73,7 @@ class MailInfoValidationRequestTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
$mail = MailInfoValidationRequest::create( $mail = MailInfoValidationRequest::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -14,7 +14,7 @@ class MailRecordsExportTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
return MailRecordsExport::create( return MailRecordsExport::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -14,7 +14,7 @@ class MailRequestEmailConfirmationTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
return MailRequestEmailConfirmation::create( return MailRequestEmailConfirmation::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -14,7 +14,7 @@ class MailRequestEmailUpdateTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
return MailRequestEmailUpdate::create( return MailRequestEmailUpdate::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -21,7 +21,7 @@ class MailRequestPasswordSetupTest extends MailWithLinkTestCase
public function testThatALogicExceptionIsThrownIfNoLoginProvided() public function testThatALogicExceptionIsThrownIfNoLoginProvided()
{ {
$mail = MailRequestPasswordSetup::create( $mail = MailRequestPasswordSetup::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),
@@ -40,7 +40,7 @@ class MailRequestPasswordSetupTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
$mail = MailRequestPasswordSetup::create( $mail = MailRequestPasswordSetup::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -21,7 +21,7 @@ class MailRequestPasswordUpdateTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
$mail = MailRequestPasswordUpdate::create( $mail = MailRequestPasswordUpdate::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),
@@ -37,7 +37,7 @@ class MailRequestPasswordUpdateTest extends MailWithLinkTestCase
public function testThatALogicExceptionIsThrownIfNoLoginProvided() public function testThatALogicExceptionIsThrownIfNoLoginProvided()
{ {
$mail = MailRequestPasswordUpdate::create( $mail = MailRequestPasswordUpdate::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -14,7 +14,7 @@ class MailSuccessAccessRequestTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
return MailSuccessAccessRequest::create( return MailSuccessAccessRequest::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -14,7 +14,7 @@ class MailSuccessEmailConfirmationRegisteredTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
return MailSuccessEmailConfirmationRegistered::create( return MailSuccessEmailConfirmationRegistered::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -14,7 +14,7 @@ class MailSuccessEmailConfirmationUnregisteredTest extends MailWithLinkTestCase
public function getMail() public function getMail()
{ {
return MailSuccessEmailConfirmationUnregistered::create( return MailSuccessEmailConfirmationUnregistered::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage(), $this->getMessage(),

View File

@@ -14,7 +14,7 @@ class MailSuccessEmailUpdateTest extends MailTestCase
public function getMail() public function getMail()
{ {
return MailSuccessEmailUpdate::create( return MailSuccessEmailUpdate::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()

View File

@@ -20,7 +20,7 @@ class MailSuccessFTPSenderTest extends MailTestCase
public function testThatALgicExceptionIsThrownIfNoServerSet() public function testThatALgicExceptionIsThrownIfNoServerSet()
{ {
$mail = MailSuccessFTPSender::create( $mail = MailSuccessFTPSender::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()
@@ -37,7 +37,7 @@ class MailSuccessFTPSenderTest extends MailTestCase
public function getMail() public function getMail()
{ {
$mail = MailSuccessFTPSender::create( $mail = MailSuccessFTPSender::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()

View File

@@ -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'); $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() public function getReceiverMock()
{ {
return $this->getMock('Alchemy\Phrasea\Notification\ReceiverInterface'); return $this->getMock('Alchemy\Phrasea\Notification\ReceiverInterface');

View File

@@ -14,7 +14,7 @@ class MailTestTest extends MailTestCase
public function getMail() public function getMail()
{ {
return MailTest::create( return MailTest::create(
$this->getApp(), $this->getApplication(),
$this->getReceiverMock(), $this->getReceiverMock(),
$this->getEmitterMock(), $this->getEmitterMock(),
$this->getMessage() $this->getMessage()

View File

@@ -47,7 +47,7 @@ class UserProviderTest extends \PhraseanetTestCase
// mandatory until user rights are managed by doctrine // 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']); //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']; $params = $app['db.appbox.info'];
$info = $app['db.info']($params); $info = $app['db.info']($params);
$key = $app['orm.add']($info); $key = $app['orm.add']($info);

View File

@@ -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']]); $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) { if (!self::$api) {
$application = self::$DI['app']; $application = $this->getApplication();
try { try {
self::$api = Bridge_Api::get_by_api_name($application, 'apitest'); self::$api = Bridge_Api::get_by_api_name($application, 'apitest');
} catch (Bridge_Exception_ApiNotFound $e) { } catch (Bridge_Exception_ApiNotFound $e) {

View File

@@ -36,8 +36,7 @@ abstract class PhraseanetAuthenticatedTestCase extends \PhraseanetTestCase
->method('get') ->method('get')
->will($this->returnValue($stubbedACL)); ->will($this->returnValue($stubbedACL));
/** @var \Alchemy\Phrasea\Application $app */ $app = $this->getApplication();
$app = self::$DI['app'];
$app['acl'] = $aclProvider; $app['acl'] = $aclProvider;
$app->setAclProvider($aclProvider); $app->setAclProvider($aclProvider);

View File

@@ -78,8 +78,7 @@ abstract class PhraseanetAuthenticatedWebTestCase extends \PhraseanetAuthenticat
{ {
$this->createDatabase(); $this->createDatabase();
/** @var Application $app */ $app = $this->getApplication();
$app = self::$DI['app'];
$info = $app['phraseanet.configuration']['main']['database']; $info = $app['phraseanet.configuration']['main']['database'];
try { try {
@@ -117,10 +116,9 @@ abstract class PhraseanetAuthenticatedWebTestCase extends \PhraseanetAuthenticat
return $databox; return $databox;
} }
public static function dropDatabase() public function dropDatabase()
{ {
/** @var Application $app */ $app = $this->getApplication();
$app = self::$DI['app'];
$connection = $app->getApplicationBox()->get_connection(); $connection = $app->getApplicationBox()->get_connection();
$stmt = $connection->prepare('DROP DATABASE IF EXISTS `unit_test_db`'); $stmt = $connection->prepare('DROP DATABASE IF EXISTS `unit_test_db`');
$stmt->execute(); $stmt->execute();
@@ -132,10 +130,9 @@ abstract class PhraseanetAuthenticatedWebTestCase extends \PhraseanetAuthenticat
protected function createDatabase() protected function createDatabase()
{ {
self::dropDatabase(); $this->dropDatabase();
/** @var Application $app */ $app = $this->getApplication();
$app = self::$DI['app'];
$stmt = $app $stmt = $app
->getApplicationBox() ->getApplicationBox()
->get_connection() ->get_connection()

View File

@@ -271,6 +271,14 @@ abstract class PhraseanetTestCase extends WebTestCase
self::$fixtureIds = $decodedFixtureIds; self::$fixtureIds = $decodedFixtureIds;
} }
/**
* @return Application
*/
public function getApplication()
{
return self::$DI['app'];
}
public static function tearDownAfterClass() public static function tearDownAfterClass()
{ {
gc_collect_cycles(); gc_collect_cycles();

View File

@@ -17,7 +17,7 @@ class patch_380alpha3bTest extends \PhraseanetTestCase
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$app = self::$DI['app']; $app = $this->getApplication();
$app['conf'] = $this->getMockBuilder('Alchemy\Phrasea\Core\Configuration\PropertyAccess') $app['conf'] = $this->getMockBuilder('Alchemy\Phrasea\Core\Configuration\PropertyAccess')
->disableOriginalConstructor() ->disableOriginalConstructor()