mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 03:53:13 +00:00
Fix unit tests
This commit is contained in:
@@ -10,8 +10,9 @@
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
use Alchemy\Phrasea\Notification\Mail\MailInfoValidationDone;
|
||||
use Alchemy\Phrasea\Notification\Emitter;
|
||||
use Alchemy\Phrasea\Notification\Receiver;
|
||||
|
||||
class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
|
||||
{
|
||||
@@ -85,34 +86,31 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
|
||||
$mailed = false;
|
||||
|
||||
if ($this->shouldSendNotificationFor($params['to'])) {
|
||||
$readyToSend = false;
|
||||
try {
|
||||
$user_from = User_Adapter::getInstance($params['from'], $this->app);
|
||||
$user_to = User_Adapter::getInstance($params['to'], $this->app);
|
||||
} catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
$basket = $this->app['EM']
|
||||
->getRepository('\Entities\Basket')
|
||||
->find($params['ssel_id']);
|
||||
$title = $basket->getName();
|
||||
|
||||
$receiver = Receiver::fromUser($user_to);
|
||||
$emitter = Emitter::fromUser($user_from);
|
||||
|
||||
$readyToSend = true;
|
||||
} catch (\Exception $e) {
|
||||
$title = '';
|
||||
|
||||
}
|
||||
|
||||
$receiver = Receiver::fromUser($user_to);
|
||||
$emitter = Receiver::fromUser($user_from);
|
||||
|
||||
try {
|
||||
if ($readyToSend) {
|
||||
$mail = MailInfoValidationDone::create($this->app, $receiver, $emitter);
|
||||
$mail->setButtonUrl($params['url']);
|
||||
$mail->setTitle($title);
|
||||
|
||||
$this->app['notification.deliverer']->deliver($mail);
|
||||
$mailed = true;
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user