Beispiel #1
0
 protected function openFile()
 {
     if (!is_readable($this->name)) {
         throw ExceptionFactory::createOpenFile(__FILE__, __LINE__, $this->getFileName(), 'reading');
     }
     $this->filePointer = fopen($this->name, 'r');
 }
Beispiel #2
0
 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);
 }