Docblock update
[htmlpurifier.git] / tests / FSTools / FileSystemHarness.php
blob8e2e21910d378663f2bee7135b7e2b2f07af9568
1 <?php
3 /**
4 * Test harness that sets up a filesystem sandbox for file-emulation
5 * functions to safely unit test in.
7 * @todo Make an automatic FSTools mock or something
8 */
9 class FSTools_FileSystemHarness extends UnitTestCase
12 protected $dir, $oldDir;
14 public function __construct()
16 parent::__construct();
17 $this->dir = 'tmp/' . md5(uniqid(rand(), true)) . '/';
18 mkdir($this->dir);
19 $this->oldDir = getcwd();
23 public function __destruct()
25 FSTools::singleton()->rmdirr($this->dir);
28 public function setup()
30 chdir($this->dir);
33 public function tearDown()
35 chdir($this->oldDir);
40 // vim: et sw=4 sts=4