|
56 | 56 | use User; |
57 | 57 |
|
58 | 58 | /** |
59 | | - * Test Plan / Spec |
| 59 | + * OLA functional specifications (extracted from test plan below) |
| 60 | + * |
| 61 | + * - multiple OLA can be associated to a ticket (no more just a single tto and a single ttr) |
| 62 | + * - ola due dates cannot be set manually anymore in a ticket |
| 63 | + * - the same ola can be associated multiple times to a ticket, if one is completed. |
| 64 | + * - old form params are still supported (olas_id_tto, olas_id_ttr) |
| 65 | + * - ola must be associated with a group (if the group has the ability to be assigned to a ticket) |
| 66 | + * - ola previously created (without group) can be associated to tickets |
| 67 | + * - ola can be associated to ticket by rule and form at the same time |
| 68 | + * - completion : |
| 69 | + * - tto : |
| 70 | + * - when ticket is "taken into account" (add task, add followup) by a user of the ola group |
| 71 | + * - when a user of the dedicated group assign itself (or it's group) to the ticket. |
| 72 | + * - when a group associated to ola is removed from ticket assigned group |
| 73 | + * - ttr : |
| 74 | + * - when the ticket is closed or solved |
| 75 | + * - when a group associated to ola is removed from ticket assigned group |
| 76 | + * - due time delaying : |
| 77 | + * - ttr : when the ticket status is WAITING |
| 78 | + * - tto : when the ticket status is WAITING and ticket is not assigned to group |
| 79 | + * - due_time is not updated on ticket's date update |
| 80 | + * - ticket is late if : |
| 81 | + * - end_time is defined and > due_time |
| 82 | + * - end_time is not defined & due_time is passed |
| 83 | + * - ticket status is not WAITING |
| 84 | + */ |
| 85 | + |
| 86 | +/** |
| 87 | + * Test Plan |
| 88 | + * |
60 | 89 | * - ola waiting_start is set to current time on ticket creation with waiting status : @see self::testOlaWaitingStartIsSetOnTicketCreationWithWaitingStatus() |
61 | 90 | * - ola data are retrieved : @see self::testGetOLAData() |
62 | 91 | * - ola can be associated and deassociate to a ticket : |
|
89 | 118 | * - on ticket update : @see self::testInitialOlaTtoValuesOnUpdate() |
90 | 119 | * |
91 | 120 | * - completion : |
92 | | - * - is done when the dedicated group is assigned to the ticket : @see self::testOlaTtoIsCompleteWhenTicketIsAssignedToDedicatedGroup() |
93 | | - * - is done when a user of the dedicated group is assigned to the ticket by a user of the ola group : @see self::testOlaTtoIsCompleteWhenTicketIsAssignedToUserInDedicatedGroupByUserOfOlaGroup() |
| 121 | + * - is done when a user of the dedicated group is assigned to the ticket by a user of the ola group : @see self::testOlaTtoIsCompleteWhenTicketIsAssignedToUserInDedicatedGroupByUserOfOlaGroup() |
94 | 122 | * - is not done when a user of the dedicated group is assigned to the ticket by foreign user of the ola group : @see self::testOlaTtoIsCompleteWhenTicketIsAssignedToUserInDedicatedGroupByUserOfAnotherGroup() |
95 | | - * - is not done when a non dedicated group is assigned to the ticket : @see self::testOlaIsNotCompleteWhenTicketIsAssignedToNonDedicatedGroup() |
| 123 | + * - is not done when a non-dedicated group is assigned to the ticket : @see self::testOlaIsNotCompleteWhenTicketIsAssignedToNonDedicatedGroup() |
96 | 124 | * - is not done when a user not in the dedicated group is assigned to the ticket : @see self::testOlaTtoIsNotCompleteWhenTicketIsAssignedToUserNotInDedicatedGroup() |
97 | 125 | * - is done when a group associated to ola is removed from ticket assigned group : |
98 | 126 | * - @see self::testOlaTtoIsCompleteWhenGroupAssociatedToOlaIsRemovedFromTicketAssignedGroup() |
|
101 | 129 | * - @see self::testOlaTtoIsCompleteWhenUserOfGroupAssociatedToOlaTakesTicketIntoAccountWithATask() |
102 | 130 | * - is not done when ticket is updated(add task, add followup) by a user not in the ola group : @see self::testOlaTtoIsNotCompleteWhenUserNotOfGroupAssociatedToOlaTakesTicketIntoAccount() |
103 | 131 | * |
104 | | - * - delay (ticket has been paused) : // @todo peut-être qu'on en peut lister ici que les tests qui ont un sens au niveau spec et pas les tests qui sont des vérifications liées (ex les vérifs sur waiting_time sont des implications) -> oui ou plutot faire plusieurs assertions dans le meme test. |
| 132 | + * - delay (ticket has been paused) : |
105 | 133 | * - due time is delayed if the ticket status is WAITING and ticket is not assigned to group: @see self::testOlaTTODueTimeIsDelayedWhileTicketStatusIsWaitingAndNotAssignedToOlaGroup() |
106 | | - * - waiting time is not incremented while the ticket is WAITING and not assigned to ola group @see self::testOlaTTOWaitingTimeIsIncrementedWhileTicketStatusIsWaitingAndNotAssignedToOlaGroup() |
| 134 | + * - waiting time is incremented while the ticket is WAITING and not assigned to ola group @see self::testOlaTTOWaitingTimeIsIncrementedWhileTicketStatusIsWaitingAndNotAssignedToOlaGroup() |
107 | 135 | * - due time is not delayed if the ticket status is WAITING and ticket is assigned to group: @see self::testOlaTTODueTimeIsNotDelayedWhileTicketStatusIsWaitingAndAssignedToOlaGroup() |
108 | 136 | * - waiting time is not incremented while the ticket is WAITING and assigned to ola group @see self::testOlaTTOWaitingTimeIsNotIncrementedWhileTicketStatusIsWaitingAndAssignedToOlaGroup() |
109 | 137 | * |
| 138 | + * - ticket is late if : (business logic extracted from CommonITILObject::generateSLAOLAComputation())* |
| 139 | + * - end_time is defined and > due_time - @see self::testOlaTtoIsLateWhenEndTimeIsAfterDueTime() |
| 140 | + * - end_time is not defined & due_time is passed - @see self::testOlaTtoIsLateWhenDueTimeIsPassed() |
| 141 | + * - ticket status is not WAITING (1): @see self::testOlaTtoIsNotLateWhenTicketStatusIsNotWaiting() |
| 142 | + * |
110 | 143 | * - ola can be associated by rule and form at the same time @see self::testOlaCanBeAssociatedByRulesAndByForm() |
111 | 144 | * - due_time is not updated on ticket date update @see self::testOlaTtoDueTimeIsNotUpdatedOnTicketDateUpdate() |
112 | 145 | * |
|
124 | 157 | * - ttr due time is delayed if the ticket status is WAITING : @see self::testOlaTtrDueTimeIsDelayedWhileTicketStatusIsWaiting |
125 | 158 | * - ttr waiting time is incremented while the ticket status is WAITING : @see self::testOlaTTRWaitingTimeIsIncrementedWhileTicketStatusIsWaiting() |
126 | 159 | * |
127 | | - * - ticket is late if : (business logic extracted from CommonITILObject::generateSLAOLAComputation())* |
128 | | - * - tto : (note that takeintoaccountdate is replaced by end_time) |
129 | | - * - end_time is defined and > due_time - @see self::testOlaTtoIsLateWhenEndTimeIsAfterDueTime() |
130 | | - * - end_time is not defined & due_time is passed - @see self::testOlaTtoIsLateWhenDueTimeIsPassed() |
131 | | - * - ticket status is not WAITING (1): @see self::testOlaTtoIsNotLateWhenTicketStatusIsNotWaiting() |
132 | | - * |
133 | | - * - ttr : exactly the same tests as above, duplication to be prepared for future changes |
| 160 | + * - ticket is late if : exactly the same tests as for tto (duplication to be prepared for future changes) |
134 | 161 | * - end_time is defined and > due_time - @see self::testOlaTtrIsLateWhenEndTimeIsAfterDueTime() |
135 | 162 | * - end_time is not defined & due_time is passed - @see self::testOlaTtrIsLateWhenDueTimeIsPassed() |
136 | 163 | * - ticket status is not WAITING (1): @see self::testOlaTtrIsNotLateWhenTicketStatusIsNotWating() |
137 | 164 | * |
138 | 165 | * - due_time is not updated on ticket date update @see self::testOlaTtrDueTimeIsNotUpdatedOnTicketDateUpdate() |
139 | | - * - when completion is done, the associated group is removed from ticket assignees : not implemented, seems not relevant atm |
140 | 166 | */ |
141 | 167 |
|
142 | 168 | class OLATest extends DbTestCase |
@@ -846,7 +872,7 @@ public function testOlaTtoIsNotCompleteWhenTicketIsAssignedToUserNotInDedicatedG |
846 | 872 | $ola_data = $ticket->getOlasData()[0]; |
847 | 873 | assert(null === $ola_data['end_time'], 'End time should not be set when OLA is assigned to ticket.'); |
848 | 874 |
|
849 | | - // act - assign ticket to a user of dedicated group |
| 875 | + // act - assign ticket to a user not in the dedicated group |
850 | 876 | $ticket = $this->updateItem(Ticket::class, $ticket->getID(), ['_users_id_assign' => $user->getID()]); |
851 | 877 | assert($ticket->isUser(CommonITILActor::ASSIGN, $user->getID()), 'Ticket should be assigned to a user of ola dedicated group.'); |
852 | 878 |
|
@@ -1416,18 +1442,20 @@ public function testOlaTtoIsNotLateWhenTicketStatusIsNotWaiting(): void |
1416 | 1442 | $this->assertFalse((bool) $ola_data['is_late'], 'OLA should not be late when ticket is just created.'); |
1417 | 1443 |
|
1418 | 1444 | // act : wait for ola to be late, set ticket status to WAITING |
1419 | | - $this->updateItem(Ticket::class, $ticket->getID(), ['status' => CommonITILObject::WAITING]); |
1420 | | - |
1421 | 1445 | $later = $now |
1422 | 1446 | ->add($this->getDefaultOlaTtoDelayInterval()) |
1423 | 1447 | ->modify('+1 hour') // add 1 hour to ensure end time is after due time |
1424 | 1448 | ->format('Y-m-d H:i:s'); |
1425 | 1449 | $this->setCurrentTime($later); |
1426 | 1450 | $this->runOlaCron(); |
1427 | 1451 |
|
1428 | | - // assert - check ola is not late |
| 1452 | + // assert - check ola is late if ticket is not waiting and not late if ticket is in WAITING status |
1429 | 1453 | $ticket = $this->reloadItem($ticket); |
1430 | 1454 | $ola_data = $ticket->getOlasData()[0]; |
| 1455 | + $this->assertEquals(1, $ola_data['is_late']); |
| 1456 | + |
| 1457 | + $ticket = $this->updateItem(Ticket::class, $ticket->getID(), ['status' => CommonITILObject::WAITING]); |
| 1458 | + $ola_data = $ticket->getOlasData()[0]; |
1431 | 1459 | $this->assertEquals(0, $ola_data['is_late'], 'OLA should not be late when ticket is WAITING (even if due time is passed and end time is not set)'); |
1432 | 1460 | } |
1433 | 1461 |
|
|
0 commit comments