Files
tehnobox/tests/Unit/ImageUrlResolutionTest.php
ssww23 93a655235a
Some checks failed
Deploy / deploy (push) Has been cancelled
Initial commit
2026-03-10 00:55:37 +03:00

35 lines
1005 B
PHP

<?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);
}
}