protected function openFile() { if (!is_readable($this->name)) { throw ExceptionFactory::createOpenFile(__FILE__, __LINE__, $this->getFileName(), 'reading'); } $this->filePointer = fopen($this->name, 'r'); }
public function testCreateOpenFileException() { $ioException = new IOException('source.php', 8, 'Cannot open file source.phpml for reading'); $exception = ExceptionFactory::createOpenFile('source.php', 8, 'source.phpml', 'reading'); $this->assertSame($ioException->getFile(), $exception->getFile()); $this->assertSame($ioException->getLine(), $exception->getLine()); $this->assertSame($ioException->getMessage(), $exception->getMessage()); $this->assertInstanceOf('PHPML\\Exception\\IOException', $exception); }