Files
KanbanGit/tests/Feature/Models/ProjectTest.php
T

49 lines
1.1 KiB
PHP

<?php
namespace Tests\Feature\Models;
use App\Models\Project;
use Database\Seeders\ProjectSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class ProjectTest extends TestCase
{
use RefreshDatabase;
/**
* Ensure project keys are always stored in uppercase.
*/
public function test_project_keys_are_stored_in_uppercase(): void
{
$project = Project::factory()->create([
'key' => 'core',
]);
$this->assertSame('CORE', $project->fresh()->key);
}
/**
* Ensure the project seeder creates the expected starter projects.
*/
public function test_project_seeder_creates_projects(): void
{
$this->seed(ProjectSeeder::class);
$this->assertDatabaseHas('projects', [
'name' => 'Core Platform',
'key' => 'CORE',
]);
$this->assertDatabaseHas('projects', [
'name' => 'Authentication',
'key' => 'AUTH',
]);
$this->assertDatabaseHas('projects', [
'name' => 'Operations',
'key' => 'OPS',
]);
}
}