Fix iconv truncation bug.
[htmlpurifier.git] / tests / FSTools / FileSystemHarness.php
blob710196e4f194d194c084952a65c72c41d8e1e6d4
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 function __construct() {
15 parent::__construct();
16 $this->dir = 'tmp/' . md5(uniqid(rand(), true)) . '/';
17 mkdir($this->dir);
18 $this->oldDir = getcwd();
22 function __destruct() {
23 FSTools::singleton()->rmdirr($this->dir);
26 function setup() {
27 chdir($this->dir);
30 function tearDown() {
31 chdir($this->oldDir);
36 // vim: et sw=4 sts=4