org\bovigo\vfs\vfsStream::newBlock PHP Method

newBlock() public static method

returns a new block with the given name
public static newBlock ( string $name, integer $permissions = null ) : org\bovigo\vfs\vfsStreamBlock
$name string name of the block device
$permissions integer permissions of block to create
return org\bovigo\vfs\vfsStreamBlock
    public static function newBlock($name, $permissions = null)
    {
        return new vfsStreamBlock($name, $permissions);
    }

Usage Example

 /**
  * @test
  */
 public function visitFileWritesBlockDeviceToStream()
 {
     $output = vfsStream::newFile('foo.txt')->at(vfsStream::setup());
     $printVisitor = new vfsStreamPrintVisitor(fopen('vfs://root/foo.txt', 'wb'));
     $this->assertSame($printVisitor, $printVisitor->visitBlockDevice(vfsStream::newBlock('bar')));
     $this->assertEquals("- [bar]\n", $output->getContent());
 }
All Usage Examples Of org\bovigo\vfs\vfsStream::newBlock