Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Clone this wiki locally
Available since release 1.4.0
Block devices can also be mocked in the filesystem. Allowing checks from commands like
filetype to return
block, while internally acting like a file. The block devices can be added like any other object in vfs.
$root = vfsStream::setup(); $block = vfsStream::newBlock('blockDevice'); // Since in a real file system, block devices are really just files // vfsStream handles it the same way $block->withContent('Content in block device'); $root->addChild($block);
Block devices can also be created easily with the complex structure method when mocking a large structure.
$structure = array( 'Core' => array( 'AbstractFactory' => array( 'test.php' => 'some text content', 'other.php' => 'Some more text content', 'Invalid.csv' => 'Something else', ), '[BlockDevice]' => 'Block Device Content', 'badlocation.php' => 'some bad content', ) );
Placing brackets around the filename will create a block device with the name enclosed inside it. The above example would be accessed: