Implement ticket types priorities and custom fields
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\Models;
|
||||
|
||||
use App\Models\Project;
|
||||
use App\Models\TicketPriority;
|
||||
use Database\Seeders\ProjectSeeder;
|
||||
use Database\Seeders\ProjectTicketMetadataSeeder;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class TicketPriorityTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
/**
|
||||
* Ensure the ticket priority factory creates a default position.
|
||||
*/
|
||||
public function test_ticket_priority_factory_creates_a_position(): void
|
||||
{
|
||||
$ticketPriority = TicketPriority::factory()->create();
|
||||
|
||||
$this->assertSame(1, $ticketPriority->position);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure the metadata seeder creates project-specific priorities.
|
||||
*/
|
||||
public function test_metadata_seeder_creates_project_priorities(): void
|
||||
{
|
||||
$this->seed([
|
||||
ProjectSeeder::class,
|
||||
ProjectTicketMetadataSeeder::class,
|
||||
]);
|
||||
|
||||
$coreProject = Project::query()->where('key', 'CORE')->firstOrFail();
|
||||
|
||||
$this->assertDatabaseHas('ticket_priorities', [
|
||||
'project_id' => $coreProject->id,
|
||||
'name' => 'Low',
|
||||
'position' => 1,
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('ticket_priorities', [
|
||||
'project_id' => $coreProject->id,
|
||||
'name' => 'Medium',
|
||||
'position' => 2,
|
||||
]);
|
||||
|
||||
$this->assertDatabaseHas('ticket_priorities', [
|
||||
'project_id' => $coreProject->id,
|
||||
'name' => 'High',
|
||||
'position' => 3,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user