Skip to content

Commit

Permalink
Fix units tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lainow committed Dec 30, 2024
1 parent 47eb3db commit 1a00d19
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/units/UserEscalationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ final class UserEscalationTest extends EscaladeTestCase
public function testTaskGroupEscalation()
{
$this->login();
PluginEscaladeConfig::loadInSession();

$config = new PluginEscaladeConfig();
$conf = reset($config->find());
Expand All @@ -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());
Expand Down Expand Up @@ -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])));
}
}

0 comments on commit 1a00d19

Please sign in to comment.