From ed3edcfbb4b9d07b6aa296fdfcd9036746abda11 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 2 Sep 2010 23:26:13 +0000 Subject: [PATCH] MINOR Fixed UTs (don't rewrite director rules) git-svn-id: http://svn.silverstripe.com/projects/ss2doc/branches/v2@110408 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- mysite/_config.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/mysite/_config.php b/mysite/_config.php index 93ca9dc..eccacb8 100644 --- a/mysite/_config.php +++ b/mysite/_config.php @@ -23,10 +23,20 @@ Director::addRules(20, array( )); DocumentationViewer::set_link_base(''); DocumentationViewer::$check_permission = false; -Director::addRules(10, array( - '$Action' => 'DocumentationViewer', - '' => '->current/en/cms' -)); + +// Hacky, but does the job. Without checking for this, +// all tests relying on standard URL routing will fail (e.g. ContentControllerTest) +$isRunningTest = ( + (isset($_SERVER['argv'][1]) && strpos($_SERVER['argv'][1], 'dev/tests') !== FALSE) + || (isset($_SERVER['REQUEST_URI']) && strpos($_SERVER['REQUEST_URI'], 'dev/tests') !== FALSE) +); +if(!$isRunningTest) { + Director::addRules(10, array( + '$Action' => 'DocumentationViewer', + '' => '->current/en/cms' + )); +} + DocumentationService::set_automatic_registration(false); DocumentationService::register("cms", realpath("../src/github/master/cms/docs/"), '2.4');