Keep similar-ai from tripping the global circuit on a lone URL 502, clamp Qdrant search to 100, and add Server-Timing plus slow-request logging. Studio shared props, Academy S3 exists caching, heat chunking, and Redis/scheduler hygiene stay in this rollout.
25 lines
769 B
PHP
25 lines
769 B
PHP
<?php
|
|
|
|
use App\Models\Artwork;
|
|
use App\Services\ArtworkStatsService;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
it('does not increment download stats when the original file is missing', function () {
|
|
$artwork = Artwork::factory()->create([
|
|
'is_public' => true,
|
|
'is_approved' => true,
|
|
'published_at' => now()->subDay(),
|
|
'file_name' => 'missing-original.jpg',
|
|
'file_ext' => 'jpg',
|
|
'hash' => str_repeat('ab', 32),
|
|
]);
|
|
|
|
$this->mock(ArtworkStatsService::class, function ($mock) {
|
|
$mock->shouldReceive('incrementDownloads')->never();
|
|
});
|
|
|
|
$this->get('/download/artwork/'.$artwork->id)->assertNotFound();
|
|
|
|
expect(DB::table('artwork_downloads')->where('artwork_id', $artwork->id)->count())->toBe(0);
|
|
});
|