mediable_type = Workspace::class;` * which bypasses the morph map. Using the relationship * (`$workspace->media()->create([...])` or * `$media->mediable()->associate($workspace)`) is the correct path. */ test('Workspace::media()->create persists the morphMap alias, not the FQCN', function () { $workspace = Workspace::factory()->create(); $media = $workspace->media()->create([ 'collection' => 'ai-generated', 'type' => 'image', 'path' => 'test/dummy.webp', 'original_filename' => 'dummy.webp', 'mime_type' => 'image/webp', 'size' => 100, 'order' => 0, ]); expect($media->mediable_type)->toBe('workspace'); expect($media->mediable_type)->not->toBe(Workspace::class); expect($media->mediable->is($workspace))->toBeTrue(); });