Symlink or copy all files and folders between two directories.
/** * Test FilesystemHelper::symlinkAll(). */ public function testSymlinkAll() { $testSource = $this->tempDir(true); $testDestination = $this->tempDir(); // Test plain symlinking. $this->filesystemHelper->symlinkAll($testSource, $testDestination); $this->assertFileExists($testDestination . '/test-file'); $this->assertFileExists($testDestination . '/test-dir/test-file'); $this->assertFileExists($testDestination . '/test-nesting/1/2/3/test-file'); // Test with skipping an existing file. $testDestination = $this->tempDir(); touch($testDestination . '/test-file'); $this->filesystemHelper->symlinkAll($testSource, $testDestination); $this->assertFileExists($testDestination . '/test-file'); $this->assertFileExists($testDestination . '/test-dir/test-file'); $this->assertFileExists($testDestination . '/test-nesting/1/2/3/test-file'); // Test with relative links. This has no effect on Windows. $testDestination = $this->tempDir(); $this->filesystemHelper->setRelativeLinks(true); $this->filesystemHelper->symlinkAll($testSource, $testDestination); $this->filesystemHelper->setRelativeLinks(false); $this->assertFileExists($testDestination . '/test-file'); $this->assertFileExists($testDestination . '/test-dir/test-file'); $this->assertFileExists($testDestination . '/test-nesting/1/2/3/test-file'); // Test with a blacklist. $testDestination = $this->tempDir(); touch($testSource . '/test-file2'); $this->filesystemHelper->symlinkAll($testSource, $testDestination, true, false, ['test-file']); $this->assertFileNotExists($testDestination . '/test-file'); $this->assertFileExists($testDestination . '/test-dir/test-file'); $this->assertFileExists($testDestination . '/test-nesting/1/2/3/test-file'); }