@@ -160,4 +160,39 @@ public function link_inside_directory($target) {
160160
161161 Assert::false ($ zip ->hasNext ());
162162 }
163+
164+ #[Test, Runtime(os: 'Linux ' ), Values(['../../libs/inc.pth ' , '%s/libs/inc.pth ' ])]
165+ public function link_to_file ($ target ) {
166+ $ tempDir = $ this ->tempDir ();
167+
168+ $ link = sprintf ($ target , rtrim ($ tempDir ->getURI (), DIRECTORY_SEPARATOR ));
169+ $ path = $ this ->create ([
170+ 'libs/ ' => [Sources::IS_FOLDER , 0755 ],
171+ 'libs/inc.pth ' => [Sources::IS_FILE , 'src/main/php ' ],
172+ 'project ' => [Sources::IS_FOLDER , 0755 ],
173+ 'project/src ' => [Sources::IS_FOLDER , 0755 ],
174+ 'project/src/file.txt ' => [Sources::IS_FILE , 'Test ' ],
175+ 'project/lib ' => [Sources::IS_FOLDER , 0755 ],
176+ 'project/lib/inc.pth ' => [Sources::IS_LINK , $ link ],
177+ ], $ tempDir );
178+ $ zip = $ this ->package (new Sources (new Path ($ path , 'project ' ), ['src ' , 'lib ' ]));
179+
180+ $ dir = $ zip ->next ();
181+ Assert::equals ('src/ ' , $ dir ->getName ());
182+ Assert::true ($ dir ->isDirectory ());
183+
184+ $ file = $ zip ->next ();
185+ Assert::equals ('src/file.txt ' , $ file ->getName ());
186+ Assert::equals (4 , $ file ->getSize ());
187+
188+ $ lib = $ zip ->next ();
189+ Assert::equals ('lib/ ' , $ lib ->getName ());
190+ Assert::true ($ lib ->isDirectory ());
191+
192+ $ path = $ zip ->next ();
193+ Assert::equals ('lib/inc.pth ' , $ path ->getName ());
194+ Assert::equals (12 , $ path ->getSize ());
195+
196+ Assert::false ($ zip ->hasNext ());
197+ }
163198}
0 commit comments