You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 satır
729B

  1. <?php
  2. /**
  3. * Test harness that sets up a filesystem sandbox for file-emulation
  4. * functions to safely unit test in.
  5. *
  6. * @todo Make an automatic FSTools mock or something
  7. */
  8. class FSTools_FileSystemHarness extends UnitTestCase
  9. {
  10. protected $dir, $oldDir;
  11. public function __construct()
  12. {
  13. parent::__construct();
  14. $this->dir = 'tmp/' . md5(uniqid(rand(), true)) . '/';
  15. mkdir($this->dir);
  16. $this->oldDir = getcwd();
  17. }
  18. public function __destruct()
  19. {
  20. FSTools::singleton()->rmdirr($this->dir);
  21. }
  22. public function setup()
  23. {
  24. chdir($this->dir);
  25. }
  26. public function tearDown()
  27. {
  28. chdir($this->oldDir);
  29. }
  30. }
  31. // vim: et sw=4 sts=4