3 * This file is part of vfsStream.
5 * For the full copyright and license information, please view the LICENSE
6 * file that was distributed with this source code.
8 * @package org\bovigo\vfs
10 namespace org\bovigo\vfs;
12 * Test that using windows directory separator works correct.
17 class vfsStreamWrapperDirSeparatorTestCase extends \PHPUnit_Framework_TestCase
22 * @var vfsStreamDirectory
27 * set up test environment
29 public function setUp()
31 $this->root = vfsStream::setup();
37 public function fileCanBeAccessedUsingWinDirSeparator()
39 vfsStream::newFile('foo/bar/baz.txt')
41 ->withContent('test');
42 $this->assertEquals('test', file_get_contents('vfs://root/foo\bar\baz.txt'));
49 public function directoryCanBeCreatedUsingWinDirSeparator()
51 mkdir('vfs://root/dir\bar\foo', true, 0777);
52 $this->assertTrue($this->root->hasChild('dir'));
53 $this->assertTrue($this->root->getChild('dir')->hasChild('bar'));
54 $this->assertTrue($this->root->getChild('dir/bar')->hasChild('foo'));
60 public function directoryExitsTestUsingTrailingWinDirSeparator()
68 vfsStream::create($structure, $this->root);
70 $this->assertTrue(file_exists(vfsStream::url('root/').'dir\\'));