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