Changeset 1192
- Timestamp:
- 12/26/07 20:37:22 (8 months ago)
- Files:
-
- trunk/build/vfs/package.php (modified) (1 diff)
- trunk/src/main/php/org/stubbles/vfs/vfsStreamAbstractContent.php (modified) (1 diff)
- trunk/src/main/php/org/stubbles/vfs/vfsStreamContent.php (modified) (2 diffs)
- trunk/src/main/php/org/stubbles/vfs/vfsStreamWrapper.php (modified) (3 diffs)
- trunk/src/test/php/org/stubbles/vfs/vfsStreamWrapperTestCase.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build/vfs/package.php
r1191 r1192 43 43 - added vfsStream::path() method as opposite to vfsStream::url() 44 44 - a call to vfsStreamWrapper::register() will now reset the root to null (implemented because of a hint by David Zülke) 45 - added support for is_readable() 45 46 ')); 46 47 trunk/src/main/php/org/stubbles/vfs/vfsStreamAbstractContent.php
r1143 r1192 78 78 * returns the type of the container 79 79 * 80 * @return string80 * @return int 81 81 */ 82 82 public function getType() trunk/src/main/php/org/stubbles/vfs/vfsStreamContent.php
r1143 r1192 15 15 /** 16 16 * stream content type: file 17 * 18 * @see getType() 17 19 */ 18 const TYPE_FILE = 'file';20 const TYPE_FILE = 0100000; 19 21 /** 20 22 * stream content type: directory 23 * 24 * @see getType() 21 25 */ 22 const TYPE_DIR = 'dir'; 26 const TYPE_DIR = 0040000; 27 /** 28 * stream content type: symbolic link 29 * 30 * @see getType(); 31 */ 32 #const TYPE_LINK = 0120000; 23 33 24 34 /** … … 55 65 * returns the type of the container 56 66 * 57 * @return string67 * @return int 58 68 */ 59 69 public function getType(); trunk/src/main/php/org/stubbles/vfs/vfsStreamWrapper.php
r1189 r1192 212 212 * 213 213 * @return array 214 * @todo implement correct group and user id handling based on content 215 * @todo implement correct file mode handling based on content 214 216 */ 215 217 public function stream_stat() 216 218 { 217 return array('size' => $this->content->size()); 219 return array(2 => $this->content->getType() + octdec(0777), 220 4 => 0, 221 5 => 0, 222 7 => $this->content->size(), 223 9 => $this->content->filemtime(), 224 'mode' => $this->content->getType() + octdec(0777), 225 'uid' => 0, 226 'gid' => 0, 227 'size' => $this->content->size(), 228 'mtime' => $this->content->filemtime() 229 ); 218 230 } 219 231 … … 422 434 * @param string $path path of url to return status for 423 435 * @return array 436 * @todo implement correct group and user id handling based on content 437 * @todo implement correct file mode handling based on content 424 438 */ 425 439 public function url_stat($path) … … 438 452 } 439 453 440 return array('size' => (($content->getType() !== vfsStreamContent::TYPE_DIR) ? ($content->size()) : (0)), 454 return array(2 => $content->getType() + octdec(0777), 455 4 => 0, 456 5 => 0, 457 7 => (($content->getType() !== vfsStreamContent::TYPE_DIR) ? ($content->size()) : (0)), 458 9 => $content->filemtime(), 459 'mode' => $content->getType() + octdec(0777), 460 'uid' => 0, 461 'gid' => 0, 462 'size' => (($content->getType() !== vfsStreamContent::TYPE_DIR) ? ($content->size()) : (0)), 441 463 'mtime' => $content->filemtime() 442 464 ); trunk/src/test/php/org/stubbles/vfs/vfsStreamWrapperTestCase.php
r1188 r1192 240 240 $this->assertTrue($another->hasChild('more')); 241 241 } 242 243 /** 244 * assert dirname() returns correct directory name 245 */ 246 public function testDirname() 247 { 248 $this->assertEqual(dirname($this->barURL), $this->fooURL); 249 $this->assertEqual(dirname($this->baz1URL), $this->barURL); 250 # returns "vfs:" instead of "." 251 # however this seems not to be fixable because dirname() does not 252 # call the stream wrapper 253 #$this->assertEqual(dirname(vfsStream::url('doesNotExist')), '.'); 254 } 255 256 /** 257 * assert basename() returns correct file name 258 */ 259 public function testBasename() 260 { 261 $this->assertEqual(basename($this->barURL), 'bar'); 262 $this->assertEqual(basename($this->baz1URL), 'baz1'); 263 $this->assertEqual(basename(vfsStream::url('doesNotExist')), 'doesNotExist'); 264 } 265 266 /** 267 * assert is_readable() returns always true for existing pathes 268 * 269 * As long as file mode is not supported, existing pathes will lead to true, 270 * and non-existing pathes to false. 271 */ 272 public function testIs_readable() 273 { 274 $this->assertTrue(is_readable($this->fooURL)); 275 $this->assertTrue(is_readable($this->barURL)); 276 $this->assertTrue(is_readable($this->baz1URL)); 277 $this->assertTrue(is_readable($this->baz2URL)); 278 $this->assertFalse(is_readable($this->fooURL . '/another')); 279 $this->assertFalse(is_readable(vfsStream::url('another'))); 280 } 242 281 } 243 282 ?>
