Fix notification template issues

This commit is contained in:
Frederic Guillot 2015-06-11 20:36:42 -04:00
parent e22da9d32a
commit 8dd6824734
5 changed files with 35 additions and 4 deletions

View File

@ -9,14 +9,14 @@
<strong><?= dt('Must be done before %B %e, %Y', $task['date_due']) ?></strong>
</li>
<?php endif ?>
<?php if ($task['creator_username']): ?>
<?php if (! empty($task['creator_username'])): ?>
<li>
<?= t('Created by %s', $task['creator_name'] ?: $task['creator_username']) ?>
</li>
<?php endif ?>
<li>
<strong>
<?php if ($task['assignee_username']): ?>
<?php if (! empty($task['assignee_username'])): ?>
<?= t('Assigned to %s', $task['assignee_name'] ?: $task['assignee_username']) ?>
<?php else: ?>
<?= t('There is nobody assigned') ?>
@ -28,7 +28,7 @@
<strong><?= $this->e($task['column_title']) ?></strong>
</li>
<li><?= t('Task position:').' '.$this->e($task['position']) ?></li>
<?php if ($task['category_name']): ?>
<?php if (! empty($task['category_name'])): ?>
<li>
<?= t('Category:') ?> <strong><?= $this->e($task['category_name']) ?></strong>
</li>

View File

@ -2,10 +2,16 @@
require_once __DIR__.'/Base.php';
use Model\TaskFinder;
use Model\TaskCreation;
use Model\Subtask;
use Model\Comment;
use Model\User;
use Model\File;
use Model\Project;
use Model\ProjectPermission;
use Model\Notification;
use Subscriber\NotificationSubscriber;
class NotificationTest extends Base
{
@ -230,7 +236,32 @@ class NotificationTest extends Base
public function testGetMailContent()
{
$n = new Notification($this->container);
$this->assertNotEmpty($n->getMailContent('task.open', array('task' => array('id' => 2, 'title' => 'blah'))));
$p = new Project($this->container);
$tf = new TaskFinder($this->container);
$tc = new TaskCreation($this->container);
$s = new Subtask($this->container);
$c = new Comment($this->container);
$f = new File($this->container);
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
$this->assertEquals(1, $s->create(array('title' => 'test', 'task_id' => 1)));
$this->assertEquals(1, $c->create(array('comment' => 'test', 'task_id' => 1, 'user_id' => 1)));
$this->assertEquals(1, $f->create(1, 'test', 'blah', false, 123));
$task = $tf->getDetails(1);
$subtask = $s->getById(1, true);
$comment = $c->getById(1);
$file = $c->getById(1);
$this->assertNotEmpty($task);
$this->assertNotEmpty($subtask);
$this->assertNotEmpty($comment);
$this->assertNotEmpty($file);
foreach (Subscriber\NotificationSubscriber::getSubscribedEvents() as $event => $values) {
$this->assertNotEmpty($n->getMailContent($event, array('task' => $task, 'comment' => $comment, 'subtask' => $subtask, 'file' => $file)));
}
}
public function testGetEmailSubject()