public function testGetContents() { $tempPath = sprintf('%s/%s', sys_get_temp_dir(), $this->getName()); $filePath = sprintf('%s/test.file', $tempPath); @mkdir($tempPath, 0775, true); file_put_contents($filePath, 'epiccontentz'); $file = SolutionFile::fromFile($filePath); $this->assertSame($filePath, $file->__toString()); $this->assertSame('test.file', $file->getRelativePath()); $this->assertSame($tempPath, $file->getBaseDirectory()); $this->assertSame('epiccontentz', $file->getContents()); unlink($filePath); rmdir($tempPath); }
/** * @param string $file * @throws InvalidArgumentException */ public function __construct($file) { $this->file = SolutionFile::fromFile(realpath($file)); }