summaryrefslogtreecommitdiff
path: root/tests/Unit/FileStringTest.php
blob: 2d8bc267aeb72ab13c197e79d15de916a007aad2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

use Lightscale\LaralightAssets\FileString;

test(':dataset', function(string $input, ?string $manifest, string $file) {
    $f = new FileString($input);
    expect($f->manifestName)->toBe($manifest);
    expect($f->fileUri)->toBe($file);
})->with([
    'manifest string 1' => ['main::fake.css', 'main', 'fake.css'],
    'manifest string 2' => ['main::test::fake.css', 'main', 'test::fake.css'],
    'manifest string 3' => ['main::test\::fake.css', 'main', 'test::fake.css'],
    'manifest escaped 1' => ['main\::test::fake.css', 'main::test', 'fake.css'],
    'manifest escaped 2' => ['main\::test::fake::fake.css', 'main::test', 'fake::fake.css'],
    'manifest escaped 3' => ['main\::test::fake\::fake.css', 'main::test', 'fake::fake.css'],
    'manifest escaped 4' => ['main\::test\::fake::fake.css', 'main::test::fake', 'fake.css'],
    'no manifest 1' => ['fake.css', null, 'fake.css'],
    'no manifest 2' => ['http://lightscale.co.uk/fake.css', null, 'http://lightscale.co.uk/fake.css'],
    'no manifest 3' => ['test\::fake.css', null, 'test::fake.css'],
    'no manifest 4' => ['test\::test2\::fake.css', null, 'test::test2::fake.css'],
]);