summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-07-01 19:39:07 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-07-02 08:11:34 +0200
commit0644090a80cabe51bcee580999ed33913aa24699 (patch)
tree042920bdb29d34030357da5505fabb93e092442a
parent30ac15881c304ba4b3779da54941b4b3d048f1b7 (diff)
downloadrpg-0644090a80cabe51bcee580999ed33913aa24699.tar.gz
rpg-0644090a80cabe51bcee580999ed33913aa24699.tar.bz2
reset the data directory before each test class is run
-rw-r--r--_test/bootstrap.php7
-rw-r--r--_test/core/DokuWikiTest.php20
2 files changed, 26 insertions, 1 deletions
diff --git a/_test/bootstrap.php b/_test/bootstrap.php
index 6c3d6aaa8..58ad6a0d7 100644
--- a/_test/bootstrap.php
+++ b/_test/bootstrap.php
@@ -82,7 +82,12 @@ if (getenv('PRESERVE_TMP') != 'true') {
// populate default dirs
TestUtils::rcopy(TMP_DIR, DOKU_INC.'/conf');
TestUtils::rcopy(TMP_DIR, dirname(__FILE__).'/conf');
-TestUtils::rcopy(TMP_DIR, dirname(__FILE__).'/data');
+mkdir(DOKU_TMP_DATA);
+foreach(array(
+ 'attic', 'cache', 'index', 'locks', 'media',
+ 'media_attic', 'media_meta', 'meta', 'pages', 'tmp') as $dir){
+ mkdir(DOKU_TMP_DATA.'/'.$dir);
+}
// disable all non-default plugins by default
$dh = dir(DOKU_INC.'lib/plugins/');
diff --git a/_test/core/DokuWikiTest.php b/_test/core/DokuWikiTest.php
index e47c06329..e51f1eeb1 100644
--- a/_test/core/DokuWikiTest.php
+++ b/_test/core/DokuWikiTest.php
@@ -19,6 +19,25 @@ abstract class DokuWikiTest extends PHPUnit_Framework_TestCase {
protected $pluginsDisabled = array();
/**
+ * Setup the data directory
+ *
+ * This is ran before each test class
+ */
+ public static function setUpBeforeClass() {
+ // just to be safe not to delete something undefined later
+ if(!defined('TMP_DIR')) die('no temporary directory');
+ if(!defined('DOKU_TMP_DATA')) die('no temporary data directory');
+
+ // remove any leftovers from the last run
+ if(is_dir(DOKU_TMP_DATA)){
+ TestUtils::rdelete(DOKU_TMP_DATA);
+ }
+
+ // populate default dirs
+ TestUtils::rcopy(TMP_DIR, dirname(__FILE__).'/../data/');
+ }
+
+ /**
* Reset the DokuWiki environment before each test run. Makes sure loaded config,
* language and plugins are correct.
*
@@ -26,6 +45,7 @@ abstract class DokuWikiTest extends PHPUnit_Framework_TestCase {
* @return void
*/
public function setUp() {
+
// reload config
global $conf, $config_cascade;
$conf = array();