diff --git a/tests/units/UserEscalationTest.php b/tests/units/UserEscalationTest.php index 56e0c76a..2877f290 100644 --- a/tests/units/UserEscalationTest.php +++ b/tests/units/UserEscalationTest.php @@ -38,6 +38,7 @@ final class UserEscalationTest extends EscaladeTestCase public function testTaskGroupEscalation() { $this->login(); + PluginEscaladeConfig::loadInSession(); $config = new PluginEscaladeConfig(); $conf = reset($config->find()); @@ -47,6 +48,8 @@ public function testTaskGroupEscalation() 'remove_tech' => 1 ] + $conf)); + PluginEscaladeConfig::loadInSession(); + $user1 = $user2 = new \User(); $user1->getFromDBbyName('glpi'); $this->assertGreaterThan(0, $user1->getID()); @@ -92,5 +95,32 @@ public function testTaskGroupEscalation() $ticket_user = new \Ticket_User(); $this->assertEquals(1, count($ticket_user->find(['tickets_id' => $t_id, 'type' => \CommonITILActor::ASSIGN]))); $this->assertEquals(1, count($ticket_user->find(['tickets_id' => $t_id, 'type' => \CommonITILActor::ASSIGN, 'users_id' => $user1->getID()]))); + + $this->assertTrue($config->update([ + 'remove_tech' => 0 + ] + $conf)); + + PluginEscaladeConfig::loadInSession(); + // Update ticket with two group + $this->assertTrue($ticket->update( + [ + 'id' => $t_id, + '_actors' => [ + 'assign' => [ + [ + 'items_id' => $user1->getID(), + 'itemtype' => 'User' + ], + [ + 'items_id' => $user2->getID(), + 'itemtype' => 'User' + ] + ], + ], + ] + )); + + $ticket_user = new \Ticket_User(); + $this->assertEquals(2, count($ticket_user->find(['tickets_id' => $t_id, 'type' => \CommonITILActor::ASSIGN]))); } }