@@ -44,7 +44,7 @@ public function provideFilesystems()
4444 /**
4545 * @dataProvider provideFilesystems
4646 */
47- public function testFileystems (string $ fsName )
47+ public function testFilesystems (string $ fsName )
4848 {
4949 $ kernel = $ this ->createFysystemKernel ();
5050 $ container = $ kernel ->getContainer ()->get ('test.service_container ' );
@@ -71,6 +71,39 @@ public function testTaggedCollection(string $fsName)
7171 $ this ->assertInstanceOf (FilesystemOperator::class, $ storages [$ fsName ]);
7272 }
7373
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+
74107 private function createFysystemKernel ()
75108 {
76109 (new Dotenv ())->populate ([
0 commit comments