You are here

class vfsStreamStructureVisitorTestCase in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitorTestCase.php \org\bovigo\vfs\visitor\vfsStreamStructureVisitorTestCase

Test for org\bovigo\vfs\visitor\vfsStreamStructureVisitor.

@since 0.10.0 @group issue_10

Hierarchy

Expanded class hierarchy of vfsStreamStructureVisitorTestCase

See also

https://github.com/mikey179/vfsStream/issues/10

File

vendor/mikey179/vfsStream/src/test/php/org/bovigo/vfs/visitor/vfsStreamStructureVisitorTestCase.php, line 19

Namespace

org\bovigo\vfs\visitor
View source
class vfsStreamStructureVisitorTestCase extends \PHPUnit_Framework_TestCase {

  /**
   * @test
   */
  public function visitFileCreatesStructureForFile() {
    $structureVisitor = new vfsStreamStructureVisitor();
    $this
      ->assertEquals(array(
      'foo.txt' => 'test',
    ), $structureVisitor
      ->visitFile(vfsStream::newFile('foo.txt')
      ->withContent('test'))
      ->getStructure());
  }

  /**
   * @test
   */
  public function visitFileCreatesStructureForBlock() {
    $structureVisitor = new vfsStreamStructureVisitor();
    $this
      ->assertEquals(array(
      '[foo]' => 'test',
    ), $structureVisitor
      ->visitBlockDevice(vfsStream::newBlock('foo')
      ->withContent('test'))
      ->getStructure());
  }

  /**
   * @test
   */
  public function visitDirectoryCreatesStructureForDirectory() {
    $structureVisitor = new vfsStreamStructureVisitor();
    $this
      ->assertEquals(array(
      'baz' => array(),
    ), $structureVisitor
      ->visitDirectory(vfsStream::newDirectory('baz'))
      ->getStructure());
  }

  /**
   * @test
   */
  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());
  }

}

Members