Fix unit tests

This commit is contained in:
Romain Neutron
2013-01-28 19:31:26 +01:00
parent 2fb0c60157
commit aa18c48306
43 changed files with 582 additions and 256 deletions

View File

@@ -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) {
}
}