From 8dd68247349c8df89408b41de37b3dc144712a48 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Thu, 11 Jun 2015 20:36:42 -0400 Subject: Fix notification template issues --- app/Template/notification/comment_create.php | 7 +++++ app/Template/notification/comment_creation.php | 7 ----- app/Template/notification/file_create.php | 5 +++ app/Template/notification/file_creation.php | 5 --- app/Template/notification/subtask_create.php | 17 ++++++++++ app/Template/notification/subtask_creation.php | 17 ---------- app/Template/notification/task_create.php | 43 ++++++++++++++++++++++++++ app/Template/notification/task_creation.php | 43 -------------------------- tests/units/NotificationTest.php | 33 +++++++++++++++++++- 9 files changed, 104 insertions(+), 73 deletions(-) create mode 100644 app/Template/notification/comment_create.php delete mode 100644 app/Template/notification/comment_creation.php create mode 100644 app/Template/notification/file_create.php delete mode 100644 app/Template/notification/file_creation.php create mode 100644 app/Template/notification/subtask_create.php delete mode 100644 app/Template/notification/subtask_creation.php create mode 100644 app/Template/notification/task_create.php delete mode 100644 app/Template/notification/task_creation.php diff --git a/app/Template/notification/comment_create.php b/app/Template/notification/comment_create.php new file mode 100644 index 00000000..747c4f43 --- /dev/null +++ b/app/Template/notification/comment_create.php @@ -0,0 +1,7 @@ +

e($task['title']) ?> (#)

+ +

+ +text->markdown($comment['comment']) ?> + +render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file diff --git a/app/Template/notification/comment_creation.php b/app/Template/notification/comment_creation.php deleted file mode 100644 index 747c4f43..00000000 --- a/app/Template/notification/comment_creation.php +++ /dev/null @@ -1,7 +0,0 @@ -

e($task['title']) ?> (#)

- -

- -text->markdown($comment['comment']) ?> - -render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file diff --git a/app/Template/notification/file_create.php b/app/Template/notification/file_create.php new file mode 100644 index 00000000..63f7d1b8 --- /dev/null +++ b/app/Template/notification/file_create.php @@ -0,0 +1,5 @@ +

e($task['title']) ?> (#)

+ +

+ +render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file diff --git a/app/Template/notification/file_creation.php b/app/Template/notification/file_creation.php deleted file mode 100644 index 63f7d1b8..00000000 --- a/app/Template/notification/file_creation.php +++ /dev/null @@ -1,5 +0,0 @@ -

e($task['title']) ?> (#)

- -

- -render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file diff --git a/app/Template/notification/subtask_create.php b/app/Template/notification/subtask_create.php new file mode 100644 index 00000000..e1c62b73 --- /dev/null +++ b/app/Template/notification/subtask_create.php @@ -0,0 +1,17 @@ +

e($task['title']) ?> (#)

+ +

+ + + +render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file diff --git a/app/Template/notification/subtask_creation.php b/app/Template/notification/subtask_creation.php deleted file mode 100644 index e1c62b73..00000000 --- a/app/Template/notification/subtask_creation.php +++ /dev/null @@ -1,17 +0,0 @@ -

e($task['title']) ?> (#)

- -

- - - -render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file diff --git a/app/Template/notification/task_create.php b/app/Template/notification/task_create.php new file mode 100644 index 00000000..1d834d44 --- /dev/null +++ b/app/Template/notification/task_create.php @@ -0,0 +1,43 @@ +

e($task['title']) ?> (#)

+ + + + +

+ text->markdown($task['description']) ?> + + +render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file diff --git a/app/Template/notification/task_creation.php b/app/Template/notification/task_creation.php deleted file mode 100644 index 0905d3f5..00000000 --- a/app/Template/notification/task_creation.php +++ /dev/null @@ -1,43 +0,0 @@ -

e($task['title']) ?> (#)

- - - - -

- text->markdown($task['description']) ?> - - -render('notification/footer', array('task' => $task, 'application_url' => $application_url)) ?> \ No newline at end of file diff --git a/tests/units/NotificationTest.php b/tests/units/NotificationTest.php index 4421fd47..5a7a782c 100644 --- a/tests/units/NotificationTest.php +++ b/tests/units/NotificationTest.php @@ -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() -- cgit v1.2.3