Skip to content

Commit

Permalink
phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
Rom1-B committed Oct 14, 2024
1 parent e6af468 commit 2754950
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions phpunit/functional/TicketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2737,24 +2737,22 @@ public function testAssignChangeStatus()
$this->assertTrue($ticket_user->getFromDB($ticket_user->getId()));

// check status (should still be ASSIGNED)
$this->boolean($ticket->getFromDB($tickets_id))->isTrue();
$this->integer((int) $ticket->fields['status'])
->isEqualto(\CommonITILObject::ASSIGNED);
$this->assertTrue($ticket->getFromDB($tickets_id));
$this->assertEquals(\CommonITILObject::ASSIGNED, (int) $ticket->fields['status']);

// remove associated user
$this->boolean($ticket->update([
$this->assertTrue($ticket->update([
'id' => $tickets_id,
'_actors' => [
'assign' => []
]
]))->isTrue();
]));
// check status (should be INCOMING)
$this->boolean($ticket->getFromDB($tickets_id))->isTrue();
$this->integer((int) $ticket->fields['status'])
->isEqualto(\CommonITILObject::INCOMING);
$this->assertTrue($ticket->getFromDB($tickets_id));
$this->assertEquals(\CommonITILObject::INCOMING, (int) $ticket->fields['status']);

// add associated user
$this->boolean($ticket->update([
$this->assertTrue($ticket->update([
'id' => $tickets_id,
'_actors' => [
'assign' => [
Expand All @@ -2767,14 +2765,13 @@ public function testAssignChangeStatus()
]
]
]
]))->isTrue();
]));
// check status (should be ASSIGNED)
$this->boolean($ticket->getFromDB($tickets_id))->isTrue();
$this->integer((int) $ticket->fields['status'])
->isEqualto(\CommonITILObject::ASSIGNED);
$this->assertTrue($ticket->getFromDB($tickets_id));
$this->assertEquals(\CommonITILObject::ASSIGNED, (int) $ticket->fields['status']);

// replace associated user
$this->boolean($ticket->update([
$this->assertTrue($ticket->update([
'id' => $tickets_id,
'_actors' => [
'assign' => [
Expand All @@ -2787,20 +2784,19 @@ public function testAssignChangeStatus()
]
]
]
]))->isTrue();
]));
// check status (should still be ASSIGNED)
$this->boolean($ticket->getFromDB($tickets_id))->isTrue();
$this->integer((int) $ticket->fields['status'])
->isEqualto(\CommonITILObject::ASSIGNED);
$this->assertTrue($ticket->getFromDB($tickets_id));
$this->assertEquals(\CommonITILObject::ASSIGNED, (int) $ticket->fields['status']);

// change status to WAITING
$this->boolean($ticket->update([
$this->assertTrue($ticket->update([
'id' => $tickets_id,
'status' => \CommonITILObject::WAITING
]))->isTrue();
]));

// replace associated user
$this->boolean($ticket->update([
$this->assertTrue($ticket->update([
'id' => $tickets_id,
'_actors' => [
'assign' => [
Expand All @@ -2813,11 +2809,10 @@ public function testAssignChangeStatus()
]
]
]
]))->isTrue();
]));
// check status (should still be WAITING)
$this->boolean($ticket->getFromDB($tickets_id))->isTrue();
$this->integer((int) $ticket->fields['status'])
->isEqualto(\CommonITILObject::WAITING);
$this->assertTrue($ticket->getFromDB($tickets_id));
$this->assertEquals(\CommonITILObject::WAITING, (int) $ticket->fields['status']);
}

public function testClosedTicketTransfer()
Expand Down

0 comments on commit 2754950

Please sign in to comment.