Пример #1
0
 public function testToArray()
 {
     $file = new \r8\FileSys\File($this->file);
     $this->assertSame(array("This is a string\n", "of data that is put\n", "in the test file"), $file->toArray());
     chmod($this->file, 00);
     $file = new \r8\FileSys\File($this->file);
     try {
         $file->toArray();
         $this->fail("An expected exception was not thrown");
     } catch (\r8\Exception\FileSystem $err) {
         $this->assertSame("Unable to read data from file", $err->getMessage());
     }
     $file = new \r8\FileSys\File("/path/to/missing/file");
     try {
         $file->toArray();
         $this->fail("An expected exception was not thrown");
     } catch (\r8\Exception\FileSystem\Missing $err) {
         $this->assertSame("Path does not exist", $err->getMessage());
     }
 }