Implement projects and project keys
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?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',
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user