Capability 3: Project Lifecycle Management - Phase 1 (RED) E2E Tests (12 test.fixme): - Create project with unique code - Reject duplicate project code - Valid/invalid status transitions - Estimate approved requires estimate > 0 - Workflow progression - Estimate rework path - Project on hold - Cancelled project - Set approved estimate - Update forecasted effort - Validate forecasted effort API Tests (9 markTestIncomplete): - POST /api/projects - Project code uniqueness - Status transition validation - Estimate/forecast endpoints Unit Tests (3 markTestIncomplete): - Project status state machine - ProjectPolicy authorization - Forecasted effort validation All 173 tests passing (31 backend, 32 frontend, 110 E2E)
92 lines
2.8 KiB
PHP
92 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Project;
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
use App\Models\User;
|
|
use App\Models\Project;
|
|
use App\Models\ProjectStatus;
|
|
use App\Models\ProjectType;
|
|
|
|
class ProjectTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
}
|
|
|
|
protected function loginAsManager()
|
|
{
|
|
$user = User::factory()->create([
|
|
'email' => 'manager@example.com',
|
|
'password' => bcrypt('password123'),
|
|
'role' => 'manager',
|
|
'active' => true,
|
|
]);
|
|
|
|
$response = $this->postJson('/api/auth/login', [
|
|
'email' => 'manager@example.com',
|
|
'password' => 'password123',
|
|
]);
|
|
|
|
return $response->json('access_token');
|
|
}
|
|
|
|
// 3.1.13 API test: POST /api/projects creates project
|
|
public function test_post_projects_creates_project()
|
|
{
|
|
$this->markTestIncomplete('3.1.13: Implement POST /api/projects endpoint');
|
|
}
|
|
|
|
// 3.1.14 API test: Project code must be unique
|
|
public function test_project_code_must_be_unique()
|
|
{
|
|
$this->markTestIncomplete('3.1.14: Implement project code uniqueness validation');
|
|
}
|
|
|
|
// 3.1.15 API test: Status transition validation
|
|
public function test_status_transition_validation()
|
|
{
|
|
$this->markTestIncomplete('3.1.15: Implement status state machine validation');
|
|
}
|
|
|
|
// 3.1.16 API test: Estimate approved requires estimate value
|
|
public function test_estimate_approved_requires_estimate_value()
|
|
{
|
|
$this->markTestIncomplete('3.1.16: Implement estimate approved validation');
|
|
}
|
|
|
|
// 3.1.17 API test: Full workflow state machine
|
|
public function test_full_workflow_state_machine()
|
|
{
|
|
$this->markTestIncomplete('3.1.17: Implement full workflow progression');
|
|
}
|
|
|
|
// 3.1.18 API test: PUT /api/projects/{id}/status transitions
|
|
public function test_put_projects_status_transitions()
|
|
{
|
|
$this->markTestIncomplete('3.1.18: Implement PUT /api/projects/{id}/status endpoint');
|
|
}
|
|
|
|
// 3.1.19 API test: PUT /api/projects/{id}/estimate sets approved
|
|
public function test_put_projects_estimate_sets_approved()
|
|
{
|
|
$this->markTestIncomplete('3.1.19: Implement PUT /api/projects/{id}/estimate endpoint');
|
|
}
|
|
|
|
// 3.1.20 API test: PUT /api/projects/{id}/forecast updates effort
|
|
public function test_put_projects_forecast_updates_effort()
|
|
{
|
|
$this->markTestIncomplete('3.1.20: Implement PUT /api/projects/{id}/forecast endpoint');
|
|
}
|
|
|
|
// 3.1.21 API test: Validate forecasted sum equals approved
|
|
public function test_validate_forecasted_sum_equals_approved()
|
|
{
|
|
$this->markTestIncomplete('3.1.21: Implement forecasted effort validation');
|
|
}
|
|
}
|