Frank Kleine released yesterday version 0.4.0 of vfsStream with new support for file modes, owners and groups; in addition to a bugfix for vfsStreamDirectory::addChild(). vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like PHPUnit or SimpleTest. Frank pointed also to some issues related to vfsStream :

Major problem is that the PHP functions chmod(), chown() and chgrp() do not work with vfsStream URLs due to limitations imposed by PHP (or possibly by underlying C, not sure). The stream wrapper API has no support to enable setting file modes, owner or group of a userland stream implementation. This means the usage of file mode support is limited and can not be applied to create tests for classes using one of the three functions.

You can find examples for testing file modes here. To install vfsStream add pear.php-tools.net to your pear channels (pear channel-discover pear.php-tools.net) then you can install using pear install pat/vfsStream-alpha. More information available here.