2017-06-10 15:30:54 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Unit;
|
|
|
|
|
|
|
|
use Tests\TestCase;
|
|
|
|
|
|
|
|
class ApplicationTest extends TestCase
|
|
|
|
{
|
2019-07-22 07:03:23 +00:00
|
|
|
public function setUp(): void
|
2017-06-10 15:30:54 +00:00
|
|
|
{
|
|
|
|
parent::setUp();
|
2020-09-12 15:01:48 +00:00
|
|
|
|
|
|
|
@unlink(public_path('hot'));
|
2017-06-10 15:30:54 +00:00
|
|
|
}
|
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
public function testStaticUrlsWithoutCdnAreConstructedCorrectly(): void
|
2017-06-10 15:30:54 +00:00
|
|
|
{
|
|
|
|
config(['koel.cdn.url' => '']);
|
|
|
|
|
2020-12-22 23:01:49 +00:00
|
|
|
self::assertEquals('http://localhost/', static_url());
|
|
|
|
self::assertEquals('http://localhost/foo.css', static_url('/foo.css '));
|
2017-06-10 15:30:54 +00:00
|
|
|
}
|
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
public function testStaticUrlsWithCdnAreConstructedCorrectly(): void
|
2017-06-10 15:30:54 +00:00
|
|
|
{
|
|
|
|
config(['koel.cdn.url' => 'http://cdn.tld']);
|
|
|
|
|
2020-12-22 23:01:49 +00:00
|
|
|
self::assertEquals('http://cdn.tld/', static_url());
|
|
|
|
self::assertEquals('http://cdn.tld/foo.css', static_url('/foo.css '));
|
2017-06-10 15:30:54 +00:00
|
|
|
}
|
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
public function testApplicationAssetRevisionUrlsAreConstructedCorrectlyWhenNotUsingCdn(): void
|
2017-06-10 15:30:54 +00:00
|
|
|
{
|
2020-12-22 20:11:22 +00:00
|
|
|
$manifestFile = __DIR__ . '../../blobs/rev-manifest.json';
|
2017-06-10 15:30:54 +00:00
|
|
|
config(['koel.cdn.url' => '']);
|
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
self::assertEquals('http://localhost/foo00.css', app()->rev('/foo.css', $manifestFile));
|
2017-06-10 15:30:54 +00:00
|
|
|
}
|
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
public function testApplicationAssetRevisionUrlsAreConstructedCorrectlyWhenUsingCdn(): void
|
2017-06-10 15:30:54 +00:00
|
|
|
{
|
2020-12-22 20:11:22 +00:00
|
|
|
$manifestFile = __DIR__ . '../../blobs/rev-manifest.json';
|
2017-06-10 15:30:54 +00:00
|
|
|
config(['koel.cdn.url' => 'http://cdn.tld']);
|
|
|
|
|
2020-11-14 16:57:25 +00:00
|
|
|
self::assertEquals('http://cdn.tld/foo00.css', app()->rev('/foo.css', $manifestFile));
|
2017-06-10 15:30:54 +00:00
|
|
|
}
|
|
|
|
}
|