44use io \streams \MemoryOutputStream ;
55use io \{File , Files , Folder , Path };
66use lang \Environment ;
7- use test \{After , Assert , Before , Test };
7+ use test \{After , Assert , Before , Test , Values };
88use util \cmd \Console ;
99use xp \lambda \{PackageLambda , Sources };
1010
@@ -31,6 +31,7 @@ private function cleanup(Folder $folder= null) {
3131
3232 /** Creates files and directory from given definitions */
3333 private function create (array $ definitions ): Path {
34+ $ this ->cleanup ();
3435
3536 // Create sources from definitions
3637 foreach ($ definitions as $ name => $ definition ) {
@@ -108,16 +109,17 @@ public function file_inside_directory() {
108109 Assert::false ($ zip ->hasNext ());
109110 }
110111
111- #[Test]
112- public function link_inside_directory () {
112+ #[Test, Values(['../../core ' , '%s/core ' ])]
113+ public function link_inside_directory ($ target ) {
114+ $ link = sprintf ($ target , rtrim ($ this ->tempDir ->getURI (), DIRECTORY_SEPARATOR ));
113115 $ path = $ this ->create ([
114116 'core/ ' => [Sources::IS_FOLDER , 0755 ],
115117 'core/composer.json ' => [Sources::IS_FILE , '{"require":{"php":">=7.0"}} ' ],
116118 'project ' => [Sources::IS_FOLDER , 0755 ],
117119 'project/src ' => [Sources::IS_FOLDER , 0755 ],
118120 'project/src/file.txt ' => [Sources::IS_FILE , 'Test ' ],
119121 'project/lib ' => [Sources::IS_FOLDER , 0755 ],
120- 'project/lib/core ' => [Sources::IS_LINK , ' ../../core ' ],
122+ 'project/lib/core ' => [Sources::IS_LINK , $ link ],
121123 ]);
122124 $ zip = $ this ->package (new Sources (new Path ($ path , 'project ' ), ['src ' , 'lib ' ]));
123125
0 commit comments