fix pictures 3

This commit is contained in:
2026-06-29 20:07:03 +03:30
parent 56ee99702b
commit b4585dd4f3
3 changed files with 99 additions and 6 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace Tests\Unit;
use App\Models\File;
use Illuminate\Support\Facades\Config;
use Tests\TestCase;
class FilePublicUrlTest extends TestCase
{
public function test_public_url_uses_config_domain_with_storage_path(): void
{
Config::set('app.domain', 'https://garoosigholaktala.ir/server');
$url = File::publicUrl('storage/1405/02/27/sample.jpg');
$this->assertSame(
'https://garoosigholaktala.ir/server/storage/1405/02/27/sample.jpg',
$url
);
}
public function test_public_url_derives_server_base_from_admin_url_setting(): void
{
Config::set('app.domain', null);
Config::set('app.url', 'http://localhost');
\App\Models\Setting::query()->updateOrCreate(
['key' => 'admin_url'],
['value' => 'https://garoosigholaktala.ir/admin/', 'is_active' => 1, 'title_fa' => 'admin']
);
$base = File::resolvePublicBaseUrl();
$this->assertSame('https://garoosigholaktala.ir/server', $base);
}
}