Add project listing selector, confirmed revision and private 3MF renders

This commit is contained in:
2026-11-08 18:49:32 +00:00
parent e62b6800a6
commit 4e675510fd
29 changed files with 3394 additions and 14 deletions
+41
View File
@@ -47,6 +47,47 @@ class ProjectReleaseTest extends TestCase
$this->assertDatabaseHas('project_releases', ['project_id' => $project->id, 'revision_id' => $revision->id, 'action' => 'release']);
}
/**
* A real HTML <form> POST body is always strings, never native PHP ints
* (unlike the test client's array-based helpers used elsewhere in this
* file). The matching current lock_version must still be accepted, not
* rejected as a false conflict by a strict `!==` comparing a DB int to a
* form string.
*/
public function test_release_succeeds_when_lock_version_is_submitted_as_a_matching_string(): void
{
$admin = User::factory()->create(['role' => 'admin']);
$project = Project::factory()->create();
[$revision, $snapshot] = $this->approvedRevisionWithCost($project);
$link = ProjectListingLink::factory()->for($project)->create(['lock_version' => 0, 'live_release_id' => null]);
$response = $this->actingAs($admin)->post(route('projects.listings.release', [$project, $link]), [
'revision_id' => $revision->id, 'cost_snapshot_id' => $snapshot->id, 'lock_version' => '0',
]);
$response->assertRedirect();
$this->assertNotNull($link->fresh()->live_release_id);
}
public function test_revert_succeeds_when_lock_version_is_submitted_as_a_matching_string(): void
{
$admin = User::factory()->create(['role' => 'admin']);
$project = Project::factory()->create();
[$revision, $snapshot] = $this->approvedRevisionWithCost($project);
$link = ProjectListingLink::factory()->for($project)->create(['lock_version' => 0, 'live_release_id' => null]);
$this->actingAs($admin)->post(route('projects.listings.release', [$project, $link]), [
'revision_id' => $revision->id, 'cost_snapshot_id' => $snapshot->id, 'lock_version' => 0,
]);
$firstReleaseId = $link->fresh()->live_release_id;
$response = $this->actingAs($admin)->post(route('projects.listings.revert', [$project, $link]), [
'release_id' => $firstReleaseId, 'lock_version' => '1',
]);
$response->assertRedirect();
$this->assertSame(2, $link->fresh()->lock_version);
}
public function test_uploading_v2_does_not_move_the_live_pointer(): void
{
$admin = User::factory()->create(['role' => 'admin']);