Factor out directory scanning functionality to their own class.
[xhtml-compiler.git] / tests / XHTMLCompiler / FileSystemHarness.php
blob3a6d3f16734464b2e1ad737ac6817417050ddca6
1 <?php
3 /**
4 * Test harness that sets up a filesystem sandbox for file-emulation
5 * functions to safely unit test in.
6 */
7 class XHTMLCompiler_FileSystemHarness extends UnitTestCase
10 protected $dir, $oldDir;
12 function __construct() {
13 parent::UnitTestCase();
14 $this->dir = 'tmp/' . md5(uniqid(rand(), true)) . '/';
15 mkdir($this->dir);
16 $this->oldDir = getcwd();
20 function __destruct() {
21 // individual tests must be sure to destroy their own files!
22 rmdir($this->dir);
25 function setup() {
26 chdir($this->dir);
29 function tearDown() {
30 chdir($this->oldDir);