Make sure that no events are fired if nothing have been modified in the task
This commit is contained in:
@@ -20,6 +20,7 @@ Improvements:
|
|||||||
* Remove event subscriber to update date_moved field
|
* Remove event subscriber to update date_moved field
|
||||||
* Make sure that some event subscribers are not executed multiple times
|
* Make sure that some event subscribers are not executed multiple times
|
||||||
* Show rendering time of individual templates when debug mode is enabled
|
* Show rendering time of individual templates when debug mode is enabled
|
||||||
|
* Make sure that no events are fired if nothing have been modified in the task
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class TaskModification extends Base
|
|||||||
|
|
||||||
if ($this->isFieldModified('owner_id', $event_data['changes'])) {
|
if ($this->isFieldModified('owner_id', $event_data['changes'])) {
|
||||||
$events[] = Task::EVENT_ASSIGNEE_CHANGE;
|
$events[] = Task::EVENT_ASSIGNEE_CHANGE;
|
||||||
} else {
|
} elseif (! empty($event_data['changes'])) {
|
||||||
$events[] = Task::EVENT_CREATE_UPDATE;
|
$events[] = Task::EVENT_CREATE_UPDATE;
|
||||||
$events[] = Task::EVENT_UPDATE;
|
$events[] = Task::EVENT_UPDATE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,24 @@ class TaskModificationTest extends Base
|
|||||||
$this->assertEquals(1, $event_data['owner_id']);
|
$this->assertEquals(1, $event_data['owner_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testThatNoEventAreFiredWhenNoChanges()
|
||||||
|
{
|
||||||
|
$p = new Project($this->container);
|
||||||
|
$tc = new TaskCreation($this->container);
|
||||||
|
$tm = new TaskModification($this->container);
|
||||||
|
$tf = new TaskFinder($this->container);
|
||||||
|
|
||||||
|
$this->assertEquals(1, $p->create(array('name' => 'test')));
|
||||||
|
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
|
||||||
|
|
||||||
|
$this->container['dispatcher']->addListener(Task::EVENT_CREATE_UPDATE, array($this, 'onCreateUpdate'));
|
||||||
|
$this->container['dispatcher']->addListener(Task::EVENT_UPDATE, array($this, 'onUpdate'));
|
||||||
|
|
||||||
|
$this->assertTrue($tm->update(array('id' => 1, 'title' => 'test')));
|
||||||
|
|
||||||
|
$this->assertEmpty($this->container['dispatcher']->getCalledListeners());
|
||||||
|
}
|
||||||
|
|
||||||
public function testChangeTitle()
|
public function testChangeTitle()
|
||||||
{
|
{
|
||||||
$p = new Project($this->container);
|
$p = new Project($this->container);
|
||||||
|
|||||||
Reference in New Issue
Block a user