shouldReceive('mimeType')->andReturn('audio/mpeg'); collect(SongStorageType::cases()) ->each(static function (SongStorageType $type): void { /** @var Song $song */ $song = Song::factory()->make(['storage' => $type]); $streamer = new Streamer($song); switch ($type) { case SongStorageType::S3: case SongStorageType::S3_LAMBDA: self::assertInstanceOf(S3CompatibleStreamerAdapter::class, $streamer->getAdapter()); break; case SongStorageType::DROPBOX: self::assertInstanceOf(DropboxStreamerAdapter::class, $streamer->getAdapter()); break; case SongStorageType::LOCAL: self::assertInstanceOf(LocalStreamerAdapter::class, $streamer->getAdapter()); break; } }); } }