Deploy HickLab3D Dashboard / Deploy to production (push) Failing after 23s
Replace the old touchmark/PNG identity with the supplied lockup and monogram, segmented role-aware navigation, Live/Draft listing filters with generation-based cache invalidation, and admin Projects covering immutable file revisions, listing live pointers, and exact-decimal filament/packaging/shipping costing. Additive schema only; no Etsy publication. Isolated clone tests: 301 tests, 1162 assertions.
46 lines
2.3 KiB
PHP
46 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\Project;
|
|
use App\Models\ProjectCostSnapshot;
|
|
use App\Models\ProjectRevision;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class ProjectCompletionTest extends TestCase
|
|
{
|
|
use LazilyRefreshDatabase;
|
|
|
|
public function test_shipping_allocation_is_applied_to_batch_not_just_recorded(): void
|
|
{
|
|
$project = Project::factory()->create(['currency' => 'GBP']);
|
|
$revision = ProjectRevision::factory()->for($project)->create();
|
|
$this->actingAs(User::factory()->create(['role' => 'admin']))->post(route('projects.cost-snapshots.store', $project), [
|
|
'revision_id' => $revision->id, 'basis' => 'estimate', 'currency' => 'GBP', 'batch_units' => 4,
|
|
'lines' => [['category' => 'shipping', 'description' => 'Two units per parcel', 'quantity' => '1', 'quantity_unit' => 'parcel', 'unit_rate' => '5', 'units_per_parcel' => 2]],
|
|
])->assertRedirect();
|
|
$this->assertSame('10.0000', ProjectCostSnapshot::firstOrFail()->shipping_total);
|
|
$this->assertSame('2.5000', ProjectCostSnapshot::firstOrFail()->perUnitGrandTotal());
|
|
}
|
|
|
|
public function test_cost_currency_cannot_diverge_from_project(): void
|
|
{
|
|
$project = Project::factory()->create(['currency' => 'GBP']);
|
|
$revision = ProjectRevision::factory()->for($project)->create();
|
|
$this->actingAs(User::factory()->create(['role' => 'admin']))->post(route('projects.cost-snapshots.store', $project), [
|
|
'revision_id' => $revision->id, 'basis' => 'estimate', 'currency' => 'USD', 'batch_units' => 1,
|
|
'lines' => [['category' => 'filament', 'description' => 'PLA', 'quantity' => '10', 'quantity_unit' => 'g', 'unit_rate' => '20']],
|
|
])->assertSessionHasErrors('currency');
|
|
$this->assertDatabaseCount('project_cost_snapshots', 0);
|
|
}
|
|
|
|
public function test_costing_and_revert_have_usable_labeled_forms(): void
|
|
{
|
|
$project = Project::factory()->create();
|
|
$this->actingAs(User::factory()->create(['role' => 'admin']))->get(route('projects.show', $project))->assertOk()
|
|
->assertSee('Add cost line')->assertSee('Saleable batch yield')->assertSee('Units per parcel')->assertSee('Fusion document');
|
|
}
|
|
}
|