vfsStreamStructureVisitorTestCase.php in Zircon Profile 8.0
File
vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitorTestCase.php
View source
<?php
namespace org\bovigo\vfs\visitor;
use org\bovigo\vfs\vfsStream;
class vfsStreamStructureVisitorTestCase extends \PHPUnit_Framework_TestCase {
public function visitFileCreatesStructureForFile() {
$structureVisitor = new vfsStreamStructureVisitor();
$this
->assertEquals(array(
'foo.txt' => 'test',
), $structureVisitor
->visitFile(vfsStream::newFile('foo.txt')
->withContent('test'))
->getStructure());
}
public function visitFileCreatesStructureForBlock() {
$structureVisitor = new vfsStreamStructureVisitor();
$this
->assertEquals(array(
'[foo]' => 'test',
), $structureVisitor
->visitBlockDevice(vfsStream::newBlock('foo')
->withContent('test'))
->getStructure());
}
public function visitDirectoryCreatesStructureForDirectory() {
$structureVisitor = new vfsStreamStructureVisitor();
$this
->assertEquals(array(
'baz' => array(),
), $structureVisitor
->visitDirectory(vfsStream::newDirectory('baz'))
->getStructure());
}
public function visitRecursiveDirectoryStructure() {
$root = vfsStream::setup('root', null, array(
'test' => array(
'foo' => array(
'test.txt' => 'hello',
),
'baz.txt' => 'world',
),
'foo.txt' => '',
));
$structureVisitor = new vfsStreamStructureVisitor();
$this
->assertEquals(array(
'root' => array(
'test' => array(
'foo' => array(
'test.txt' => 'hello',
),
'baz.txt' => 'world',
),
'foo.txt' => '',
),
), $structureVisitor
->visitDirectory($root)
->getStructure());
}
}