mirror of
https://github.com/koel/koel
synced 2024-12-23 19:13:06 +00:00
47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Tests\Unit;
|
|
|
|
use Tests\TestCase;
|
|
|
|
class ApplicationTest extends TestCase
|
|
{
|
|
public function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
@unlink(public_path('hot'));
|
|
}
|
|
|
|
public function testStaticUrlsWithoutCdnAreConstructedCorrectly(): void
|
|
{
|
|
config(['koel.cdn.url' => '']);
|
|
|
|
self::assertEquals('http://localhost/', static_url());
|
|
self::assertEquals('http://localhost/foo.css', static_url('/foo.css '));
|
|
}
|
|
|
|
public function testStaticUrlsWithCdnAreConstructedCorrectly(): void
|
|
{
|
|
config(['koel.cdn.url' => 'http://cdn.tld']);
|
|
|
|
self::assertEquals('http://cdn.tld/', static_url());
|
|
self::assertEquals('http://cdn.tld/foo.css', static_url('/foo.css '));
|
|
}
|
|
|
|
public function testApplicationAssetRevisionUrlsAreConstructedCorrectlyWhenNotUsingCdn(): void
|
|
{
|
|
$manifestFile = __DIR__ . '../../blobs/rev-manifest.json';
|
|
config(['koel.cdn.url' => '']);
|
|
|
|
self::assertEquals('http://localhost/foo00.css', app()->rev('/foo.css', $manifestFile));
|
|
}
|
|
|
|
public function testApplicationAssetRevisionUrlsAreConstructedCorrectlyWhenUsingCdn(): void
|
|
{
|
|
$manifestFile = __DIR__ . '../../blobs/rev-manifest.json';
|
|
config(['koel.cdn.url' => 'http://cdn.tld']);
|
|
|
|
self::assertEquals('http://cdn.tld/foo00.css', app()->rev('/foo.css', $manifestFile));
|
|
}
|
|
}
|