summaryrefslogtreecommitdiff
path: root/tests/Unit
diff options
context:
space:
mode:
authorSam Light <sam@lightscale.co.uk>2025-03-31 22:07:52 +0100
committerSam Light <samlight1994@gmail.com>2025-03-31 22:07:52 +0100
commit68fc7984097c4373d7b73538260b13dd5b4a8340 (patch)
tree4ab482231bac3eaa3ee0e66ee7282216bbf3f9b4 /tests/Unit
parent3c1056bdee2798d6bd5d9aad2f60ccbb8cb1d8d9 (diff)
Create FileString class
Diffstat (limited to 'tests/Unit')
-rw-r--r--tests/Unit/FileStringTest.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/Unit/FileStringTest.php b/tests/Unit/FileStringTest.php
new file mode 100644
index 0000000..2d8bc26
--- /dev/null
+++ b/tests/Unit/FileStringTest.php
@@ -0,0 +1,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'],
+]);