Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ddurieux committed Dec 19, 2024
1 parent 52c2240 commit c0ef256
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Models/Definitions/Ticket.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public static function getDefinition()
'id' => 4,
'title' => $translator->translatePlural('Requester', 'Requesters', 1),
'type' => 'dropdown_remote',
'name' => 'requester:id,name,firstname,lastname',
'name' => 'requester',
'itemtype' => '\App\Models\User',
'multiple' => true,
'pivot' => ['type' => 1],
Expand All @@ -222,7 +222,7 @@ public static function getDefinition()
'id' => 71,
'title' => $translator->translatePlural('Requester group', 'Requester groups', 1),
'type' => 'dropdown_remote',
'name' => 'requestergroup:id,name,completename',
'name' => 'requestergroup',
'itemtype' => '\App\Models\Group',
'multiple' => true,
'pivot' => ['type' => 1],
Expand Down Expand Up @@ -258,7 +258,7 @@ public static function getDefinition()
'id' => 5,
'title' => $translator->translate('Technician'),
'type' => 'dropdown_remote',
'name' => 'technician:id,name,firstname,lastname',
'name' => 'technician',
'itemtype' => '\App\Models\User',
'multiple' => true,
'pivot' => ['type' => 2],
Expand All @@ -278,7 +278,7 @@ public static function getDefinition()
'id' => 8,
'title' => $translator->translate('Technician group'),
'type' => 'dropdown_remote',
'name' => 'techniciangroup:id,name,completename',
'name' => 'techniciangroup',
'itemtype' => '\App\Models\Group',
'multiple' => true,
'pivot' => ['type' => 2],
Expand Down
36 changes: 36 additions & 0 deletions tests/integration/v1/Controllers/NotificationTicketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,21 @@
#[UsesClass('\App\Models\Definitions\Entity')]
#[UsesClass('\App\Models\Definitions\Followup')]
#[UsesClass('\App\Models\Definitions\Group')]
#[UsesClass('\App\Models\Definitions\ItemTicket')]
#[UsesClass('\App\Models\Definitions\Knowbaseitem')]
#[UsesClass('\App\Models\Definitions\Knowbaseitemcategory')]
#[UsesClass('\App\Models\Definitions\Location')]
#[UsesClass('\App\Models\Definitions\Notepad')]
#[UsesClass('\App\Models\Definitions\Problem')]
#[UsesClass('\App\Models\Definitions\Problemtemplate')]
#[UsesClass('\App\Models\Definitions\Profile')]
#[UsesClass('\App\Models\Definitions\ProjecttaskTicket')]
#[UsesClass('\App\Models\Definitions\Solution')]
#[UsesClass('\App\Models\Definitions\Ticket')]
#[UsesClass('\App\Models\Definitions\User')]
#[UsesClass('\App\Models\Definitions\ProfileUser')]
#[UsesClass('\App\Models\Definitions\Ticketcost')]
#[UsesClass('\App\Models\Definitions\Ticketvalidation')]
#[UsesClass('\App\Models\Definitions\Usercategory')]
#[UsesClass('\App\Models\Definitions\Usertitle')]
#[UsesClass('\App\Models\Entity')]
Expand Down Expand Up @@ -328,6 +331,39 @@ public static function setUpBeforeClass(): void
$ticket->save();
}

public static function tearDownAfterClass(): void
{
$items = \App\Models\Location::get();
foreach ($items as $item)
{
$item->forceDelete();
}

$items = \App\Models\User::where('id', '>', 1)->get();
foreach ($items as $item)
{
$item->forceDelete();
}

$items = \App\Models\Group::get();
foreach ($items as $item)
{
$item->forceDelete();
}

$items = \App\Models\Category::get();
foreach ($items as $item)
{
$item->forceDelete();
}

$items = \App\Models\Ticket::get();
foreach ($items as $item)
{
$item->forceDelete();
}
}

public function testGenerateDataForNotification(): void
{
$ticket = \App\Models\Ticket::find(self::$ticketId);
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/v1/Controllers/TicketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,19 @@
#[UsesClass('\App\Models\Definitions\Entity')]
#[UsesClass('\App\Models\Definitions\Followup')]
#[UsesClass('\App\Models\Definitions\Group')]
#[UsesClass('\App\Models\Definitions\ItemTicket')]
#[UsesClass('\App\Models\Definitions\Knowbaseitem')]
#[UsesClass('\App\Models\Definitions\Location')]
#[UsesClass('\App\Models\Definitions\Notepad')]
#[UsesClass('\App\Models\Definitions\Notification')]
#[UsesClass('\App\Models\Definitions\Problem')]
#[UsesClass('\App\Models\Definitions\Profile')]
#[UsesClass('\App\Models\Definitions\ProfileUser')]
#[UsesClass('\App\Models\Definitions\ProjecttaskTicket')]
#[UsesClass('\App\Models\Definitions\Solution')]
#[UsesClass('\App\Models\Definitions\Ticket')]
#[UsesClass('\App\Models\Definitions\Ticketcost')]
#[UsesClass('\App\Models\Definitions\Ticketvalidation')]
#[UsesClass('\App\Models\Definitions\User')]
#[UsesClass('\App\Models\Definitions\Usercategory')]
#[UsesClass('\App\Models\Definitions\Usertitle')]
Expand Down

0 comments on commit c0ef256

Please sign in to comment.