Refactor tests to use $this->getApplication().

Move LoginTest specific use case into LoginTest class
This commit is contained in:
Benoît Burnichon
2016-05-19 14:39:05 +02:00
parent f0e2ff2bd1
commit c14e48437d
2 changed files with 23 additions and 20 deletions

View File

@@ -1961,4 +1961,19 @@ class LoginTest extends \PhraseanetAuthenticatedWebTestCase
self::$DI['app']['registration.manager'] = $managerMock;
self::$DI['app']['registration.manager']->expects($this->any())->method('isRegistrationEnabled')->will($this->returnValue(false));
}
private function mockNotificationsDeliverer(array &$expectedMails)
{
$app = $this->getApplication();
$app['notification.deliverer'] = $this->getMockBuilder('Alchemy\Phrasea\Notification\Deliverer')
->disableOriginalConstructor()
->getMock();
$app['notification.deliverer']->expects($this->any())
->method('deliver')
->will($this->returnCallback(function ($email, $receipt) use (&$expectedMails) {
$this->assertTrue(isset($expectedMails[get_class($email)]));
$expectedMails[get_class($email)]++;
}));
}
}