public function testCreateSymlinkTargetDirectoryExists() { $targetDir = $this->getMockBuilder('Magento\\Framework\\Filesystem\\Directory\\WriteInterface')->getMock(); $targetDir->driver = $this->driver; $sourcePath = 'source/path/file'; $destinationDirectory = 'destination/path'; $destinationFile = $destinationDirectory . '/' . 'file'; $this->assertIsFileExpectation($sourcePath); $this->driver->expects($this->once())->method('getParentDirectory')->with($destinationFile)->willReturn($destinationDirectory); $targetDir->expects($this->once())->method('isExist')->with($destinationDirectory)->willReturn(true); $targetDir->expects($this->once())->method('getAbsolutePath')->with($destinationFile)->willReturn($this->getAbsolutePath($destinationFile)); $this->driver->expects($this->once())->method('symlink')->with($this->getAbsolutePath($sourcePath), $this->getAbsolutePath($destinationFile), $targetDir->driver)->willReturn(true); $this->assertTrue($this->write->createSymlink($sourcePath, $destinationFile, $targetDir)); }