From 390082aa41cb81610089163b1cc3a256f3b3c513 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 19 Jul 2016 22:38:30 -0400 Subject: Refactoring of internal task events --- tests/units/Model/TaskModificationModelTest.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'tests/units/Model/TaskModificationModelTest.php') diff --git a/tests/units/Model/TaskModificationModelTest.php b/tests/units/Model/TaskModificationModelTest.php index c81f968b..f70561b3 100644 --- a/tests/units/Model/TaskModificationModelTest.php +++ b/tests/units/Model/TaskModificationModelTest.php @@ -18,7 +18,8 @@ class TaskModificationModelTest extends Base $event_data = $event->getAll(); $this->assertNotEmpty($event_data); $this->assertEquals(1, $event_data['task_id']); - $this->assertEquals('Task #1', $event_data['title']); + $this->assertEquals('After', $event_data['task']['title']); + $this->assertEquals('After', $event_data['changes']['title']); } public function onUpdate($event) @@ -28,7 +29,7 @@ class TaskModificationModelTest extends Base $event_data = $event->getAll(); $this->assertNotEmpty($event_data); $this->assertEquals(1, $event_data['task_id']); - $this->assertEquals('Task #1', $event_data['title']); + $this->assertEquals('After', $event_data['task']['title']); } public function onAssigneeChange($event) @@ -38,7 +39,7 @@ class TaskModificationModelTest extends Base $event_data = $event->getAll(); $this->assertNotEmpty($event_data); $this->assertEquals(1, $event_data['task_id']); - $this->assertEquals(1, $event_data['owner_id']); + $this->assertEquals(1, $event_data['changes']['owner_id']); } public function testThatNoEventAreFiredWhenNoChanges() @@ -66,19 +67,19 @@ class TaskModificationModelTest extends Base $taskFinderModel = new TaskFinderModel($this->container); $this->assertEquals(1, $projectModel->create(array('name' => 'test'))); - $this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1))); + $this->assertEquals(1, $taskCreationModel->create(array('title' => 'Before', 'project_id' => 1))); $this->container['dispatcher']->addListener(TaskModel::EVENT_CREATE_UPDATE, array($this, 'onCreateUpdate')); $this->container['dispatcher']->addListener(TaskModel::EVENT_UPDATE, array($this, 'onUpdate')); - $this->assertTrue($taskModificationModel->update(array('id' => 1, 'title' => 'Task #1'))); + $this->assertTrue($taskModificationModel->update(array('id' => 1, 'title' => 'After'))); $called = $this->container['dispatcher']->getCalledListeners(); $this->assertArrayHasKey(TaskModel::EVENT_CREATE_UPDATE.'.TaskModificationModelTest::onCreateUpdate', $called); $this->assertArrayHasKey(TaskModel::EVENT_UPDATE.'.TaskModificationModelTest::onUpdate', $called); $task = $taskFinderModel->getById(1); - $this->assertEquals('Task #1', $task['title']); + $this->assertEquals('After', $task['title']); } public function testChangeAssignee() -- cgit v1.2.3