From 101f16249df54045291bd337e2c953cab2d49bf0 Mon Sep 17 00:00:00 2001 From: Lainow Date: Thu, 26 Sep 2024 12:16:51 +0200 Subject: [PATCH] Add Units tests --- phpunit/functional/TicketTest.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/phpunit/functional/TicketTest.php b/phpunit/functional/TicketTest.php index 2d6296927fa..d634e34230f 100644 --- a/phpunit/functional/TicketTest.php +++ b/phpunit/functional/TicketTest.php @@ -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( @@ -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', @@ -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', ], @@ -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', ], ]; @@ -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', ],