Changeset 1183
- Timestamp:
- 12/25/07 18:14:44 (1 year ago)
- Files:
-
- trunk/src/main/php/org/stubbles/vfs/examples/ExampleTestCaseWithVfsStream.php (modified) (2 diffs)
- trunk/src/main/php/org/stubbles/vfs/vfsStream.php (added)
- trunk/src/main/php/org/stubbles/vfs/vfsStreamWrapper.php (modified) (3 diffs)
- trunk/src/test/php/net/stubbles/util/cache/stubFileCacheContainerTestCase.php (modified) (2 diffs)
- trunk/src/test/php/org/stubbles/vfs/run.php (modified) (1 diff)
- trunk/src/test/php/org/stubbles/vfs/vfsStreamTestCase.php (added)
- trunk/src/test/php/org/stubbles/vfs/vfsStreamWrapperTestCase.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/main/php/org/stubbles/vfs/examples/ExampleTestCaseWithVfsStream.php
r1148 r1183 8 8 */ 9 9 require_once 'PHPUnit/Framework.php'; 10 require_once 'vfsStream/vfsStream Wrapper.php';10 require_once 'vfsStream/vfsStream.php'; 11 11 require_once 'Example.php'; 12 12 /** … … 34 34 $example = new Example('id'); 35 35 $this->assertFalse(vfsStreamWrapper::getRoot()->hasChild('id')); 36 $example->setDirectory(vfsStream Wrapper::PROTOCOL . '://exampleDir');36 $example->setDirectory(vfsStream::url('exampleDir')); 37 37 $this->assertTrue(vfsStreamWrapper::getRoot()->hasChild('id')); 38 38 } trunk/src/main/php/org/stubbles/vfs/vfsStreamWrapper.php
r1143 r1183 17 17 { 18 18 /** 19 * url scheme20 */21 const PROTOCOL = 'vfs';22 /**23 19 * switch whether class has already been registered as stream wrapper or not 24 20 * … … 56 52 } 57 53 58 if (stream_wrapper_register( self::PROTOCOL, __CLASS__) == false) {59 throw new vfsStreamException('A handler has already been registered for the ' . self::PROTOCOL. ' protocol.');54 if (stream_wrapper_register(vfsStream::SCHEME, __CLASS__) == false) { 55 throw new vfsStreamException('A handler has already been registered for the ' . vfsStream::SCHEME . ' protocol.'); 60 56 } 61 57 … … 91 87 protected static function parsePath($path) 92 88 { 93 $path = substr($path, strlen( self::PROTOCOL. '://'));89 $path = substr($path, strlen(vfsStream::SCHEME . '://')); 94 90 $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); 95 91 return $path; trunk/src/test/php/net/stubbles/util/cache/stubFileCacheContainerTestCase.php
r1143 r1183 9 9 stubClassLoader::load('net.stubbles.util.cache.stubFileCacheContainer'); 10 10 Mock::generate('stubCacheStrategy'); 11 require_once TEST_SRC_PATH . '/../main/php/org/stubbles/vfs/vfsStream Wrapper.php';11 require_once TEST_SRC_PATH . '/../main/php/org/stubbles/vfs/vfsStream.php'; 12 12 /** 13 13 * Tests for net.stubbles.util.cache.stubFileCacheContainer. … … 47 47 $this->cacheContainer = new stubFileCacheContainer('id'); 48 48 $this->cacheContainer->setStrategy($this->mockCacheStrategy); 49 $this->cacheContainer->setCacheDirectory(vfsStream Wrapper::PROTOCOL . '://cache');49 $this->cacheContainer->setCacheDirectory(vfsStream::url('cache')); 50 50 $this->cacheDirectory = vfsStreamWrapper::getRoot()->getChild('id'); 51 51 } trunk/src/test/php/org/stubbles/vfs/run.php
r1143 r1183 26 26 $testSuite->addTestFile($testFilePath . '/vfsStreamFileTestCase.php'); 27 27 $testSuite->addTestFile($testFilePath . '/vfsStreamDirectoryTestCase.php'); 28 $testSuite->addTestFile($testFilePath . '/vfsStreamTestCase.php'); 28 29 $testSuite->addTestFile($testFilePath . '/vfsStreamWrapperTestCase.php'); 29 30 if (PHP_SAPI == 'cli') { trunk/src/test/php/org/stubbles/vfs/vfsStreamWrapperTestCase.php
r1143 r1183 7 7 * @subpackage test 8 8 */ 9 require_once SRC_PATH . '/main/php/org/stubbles/vfs/vfsStream Wrapper.php';9 require_once SRC_PATH . '/main/php/org/stubbles/vfs/vfsStream.php'; 10 10 Mock::generate('vfsStreamContent'); 11 11 /** … … 71 71 public function setUp() 72 72 { 73 $this->fooURL = vfsStream Wrapper::PROTOCOL . '://foo';74 $this->barURL = vfsStream Wrapper::PROTOCOL . '://foo/bar';75 $this->baz1URL = vfsStream Wrapper::PROTOCOL . '://foo/bar/baz1';76 $this->baz2URL = vfsStream Wrapper::PROTOCOL . '://foo/baz2';73 $this->fooURL = vfsStream::url('foo'); 74 $this->barURL = vfsStream::url('foo/bar'); 75 $this->baz1URL = vfsStream::url('foo/bar/baz1'); 76 $this->baz2URL = vfsStream::url('foo/baz2'); 77 77 $this->foo = new vfsStreamDirectory('foo'); 78 78 $this->foo->setFilemtime(100); … … 164 164 $this->assertTrue(file_exists($this->baz2URL)); 165 165 $this->assertFalse(file_exists($this->fooURL . '/another')); 166 $this->assertFalse(file_exists(vfsStream Wrapper::PROTOCOL . '://another'));166 $this->assertFalse(file_exists(vfsStream::url('another'))); 167 167 } 168 168 … … 190 190 $this->assertEqual($this->foo->getChildren(), array()); 191 191 $this->assertFalse(unlink($this->fooURL . '/another')); 192 $this->assertFalse(unlink(vfsStream Wrapper::PROTOCOL . '://another'));192 $this->assertFalse(unlink(vfsStream::url('another'))); 193 193 $this->assertEqual($this->foo->getChildren(), array()); 194 194 $this->assertTrue(unlink($this->fooURL)); … … 202 202 public function testMkdirNoNewRoot() 203 203 { 204 $this->assertFalse(mkdir(vfsStream Wrapper::PROTOCOL . '://another'));204 $this->assertFalse(mkdir(vfsStream::url('another'))); 205 205 $this->assertEqual(count($this->foo->getChildren()), 2); 206 206 $this->assertReference($this->foo, vfsStreamWrapper::getRoot());
