@@ -44,7 +44,7 @@ public function provideFilesystems()
44
44
/**
45
45
* @dataProvider provideFilesystems
46
46
*/
47
- public function testFileystems (string $ fsName )
47
+ public function testFilesystems (string $ fsName )
48
48
{
49
49
$ kernel = $ this ->createFysystemKernel ();
50
50
$ container = $ kernel ->getContainer ()->get ('test.service_container ' );
@@ -71,6 +71,39 @@ public function testTaggedCollection(string $fsName)
71
71
$ this ->assertInstanceOf (FilesystemOperator::class, $ storages [$ fsName ]);
72
72
}
73
73
74
+ public function testPublicUrl ()
75
+ {
76
+ $ kernel = $ this ->createFysystemKernel ();
77
+ $ container = $ kernel ->getContainer ()->get ('test.service_container ' );
78
+
79
+ $ fs = $ container ->get ('flysystem.test.fs_public_url ' );
80
+
81
+ self ::assertSame ('https://example.org/assets/test1.txt ' , $ fs ->publicUrl ('test1.txt ' ));
82
+ }
83
+
84
+ public function testPublicUrls ()
85
+ {
86
+ $ kernel = $ this ->createFysystemKernel ();
87
+ $ container = $ kernel ->getContainer ()->get ('test.service_container ' );
88
+
89
+ $ fs = $ container ->get ('flysystem.test.fs_public_urls ' );
90
+
91
+ self ::assertSame ('https://cdn1.example.org/test1.txt ' , $ fs ->publicUrl ('test1.txt ' ));
92
+ self ::assertSame ('https://cdn2.example.org/yo/test2.txt ' , $ fs ->publicUrl ('yo/test2.txt ' ));
93
+ self ::assertSame ('https://cdn3.example.org/yww/test1.txt ' , $ fs ->publicUrl ('yww/test1.txt ' ));
94
+ }
95
+
96
+ public function testUrlGenerators ()
97
+ {
98
+ $ kernel = $ this ->createFysystemKernel ();
99
+ $ container = $ kernel ->getContainer ()->get ('test.service_container ' );
100
+
101
+ $ fs = $ container ->get ('flysystem.test.fs_url_generator ' );
102
+
103
+ self ::assertSame ('https://example.org/generator/test1.txt ' , $ fs ->publicUrl ('test1.txt ' ));
104
+ self ::assertSame ('https://example.org/temporary/test1.txt?expiresAt=1670846026 ' , $ fs ->temporaryUrl ('test1.txt ' , new \DateTimeImmutable ('@1670846026 ' )));
105
+ }
106
+
74
107
private function createFysystemKernel ()
75
108
{
76
109
(new Dotenv ())->populate ([
0 commit comments