Initial commit
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
ssww23
2026-03-10 00:55:37 +03:00
parent fc0f28d830
commit 93a655235a
155 changed files with 24768 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
<?php
namespace Tests\Unit;
use App\Models\HomeSlide;
use App\Models\Product;
use Tests\TestCase;
class ImageUrlResolutionTest extends TestCase
{
public function test_product_uses_relative_storage_url_for_uploaded_images(): void
{
$product = new Product([
'image_path' => 'products/example.jpg',
'gallery_paths' => ['products/gallery-1.jpg', 'products/gallery-2.webp'],
]);
$this->assertSame('/storage/products/example.jpg', $product->image_url);
$this->assertSame([
'/storage/products/example.jpg',
'/storage/products/gallery-1.jpg',
'/storage/products/gallery-2.webp',
], $product->gallery_urls);
}
public function test_home_slide_uses_relative_storage_url_for_uploaded_images(): void
{
$slide = new HomeSlide([
'image_path' => 'home-slides/banner.webp',
]);
$this->assertSame('/storage/home-slides/banner.webp', $slide->image_url);
}
}