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\visitor;
11 use org\bovigo\vfs\vfsStream;
13 * Test for org\bovigo\vfs\visitor\vfsStreamStructureVisitor.
16 * @see https://github.com/mikey179/vfsStream/issues/10
19 class vfsStreamStructureVisitorTestCase extends \PHPUnit_Framework_TestCase
24 public function visitFileCreatesStructureForFile()
26 $structureVisitor = new vfsStreamStructureVisitor();
27 $this->assertEquals(array('foo.txt' => 'test'),
28 $structureVisitor->visitFile(vfsStream::newFile('foo.txt')
38 public function visitFileCreatesStructureForBlock()
40 $structureVisitor = new vfsStreamStructureVisitor();
41 $this->assertEquals(array('[foo]' => 'test'),
42 $structureVisitor->visitBlockDevice(vfsStream::newBlock('foo')
52 public function visitDirectoryCreatesStructureForDirectory()
54 $structureVisitor = new vfsStreamStructureVisitor();
55 $this->assertEquals(array('baz' => array()),
56 $structureVisitor->visitDirectory(vfsStream::newDirectory('baz'))
64 public function visitRecursiveDirectoryStructure()
66 $root = vfsStream::setup('root',
68 array('test' => array('foo' => array('test.txt' => 'hello'),
74 $structureVisitor = new vfsStreamStructureVisitor();
75 $this->assertEquals(array('root' => array('test' => array('foo' => array('test.txt' => 'hello'),
81 $structureVisitor->visitDirectory($root)