Skip to content

Commit

Permalink
Add Units tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Lainow committed Sep 26, 2024
1 parent bcab183 commit 101f162
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions phpunit/functional/TicketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6418,6 +6418,19 @@ protected function timelineItemsProvider(): iterable
$normal_user_id = getItemByTypeName(\User::class, 'normal', true);
$tech_user_id = getItemByTypeName(\User::class, 'tech', true);

$n_profile = new \Profile();
$new_profile_id = $n_profile->add(
[
'name' => 'No Private Task',
'interface' => 'central',
]
);
$this->createItem(\Profile::class, [
'name' => 'No Private Task',
'interface' => 'central',
'_entities_id' => getItemByTypeName('Entity', '_test_root_entity', true),
]);

$this->login();

$ticket = $this->createItem(
Expand Down Expand Up @@ -6496,6 +6509,17 @@ protected function timelineItemsProvider(): iterable
]
);

$this->createItem(
\TicketTask::class,
[
'tickets_id' => $ticket->getID(),
'content' => 'private task of only see his task user',
'is_private' => 1,
'users_id_tech' => $normal_user_id,
'date_creation' => date('Y-m-d H:i:s', strtotime('+30s', $now)), // to ensure result order is correct
]
);

// tech has rights to see all private followups/tasks
yield [
'login' => 'tech',
Expand All @@ -6509,6 +6533,7 @@ protected function timelineItemsProvider(): iterable
],
'expected_tasks' => [
'private task of normal user',
'private task of only see his task user',
'private task of tech user',
'public task',
],
Expand All @@ -6526,6 +6551,7 @@ protected function timelineItemsProvider(): iterable
],
'expected_tasks' => [
'private task of normal user',
'private task of only see his task user',
'public task',
],
];
Expand Down Expand Up @@ -6561,6 +6587,7 @@ protected function timelineItemsProvider(): iterable
],
'expected_tasks' => [
'private task of normal user',
'private task of only see his task user',
'private task of tech user',
'public task',
],
Expand Down

0 comments on commit 101f162

Please sign in to comment.