Exemplo n.º 1
0
 public function testOpenAndClose()
 {
     $url = $this->_root->url() . '/test.txt';
     $fileObject = new FileObject($url, 'w');
     $this->assertFileExists($url);
     $this->assertEquals($url, $fileObject->getPathname());
     // Test parent constructor invocation
     $file = \PHPUnit_Framework_Assert::readAttribute($fileObject, '_file');
     $metadata = stream_get_meta_data($file);
     $this->assertEquals($url, $metadata['uri']);
     $this->assertEquals('w', $metadata['mode']);
     // Close file by destroying the object. File pointer should become invalid.
     unset($fileObject);
     $this->assertFalse(@stream_get_meta_data($file));
 }
Exemplo n.º 2
0
 public function testOpenAndClose()
 {
     $url = $this->_root->url() . '/test.txt';
     $fileObject = new FileObject($url, 'w');
     $this->assertFileExists($url);
     $this->assertEquals($url, $fileObject->getPathname());
     // Test parent constructor invocation
     $reflectionObject = new \ReflectionClass($fileObject);
     $reflectionProperty = $reflectionObject->getProperty('_file');
     $reflectionProperty->setAccessible(true);
     $file = $reflectionProperty->getValue($fileObject);
     $metadata = stream_get_meta_data($file);
     $this->assertEquals($url, $metadata['uri']);
     $this->assertEquals('w', $metadata['mode']);
     // Close file by destroying the object. File pointer should become invalid.
     unset($fileObject);
     $this->assertFalse(@stream_get_meta_data($file));
 }