From e8bfc241fdc5ff957646fe2ff2a2b05a243ad96e Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 9 Jan 2013 23:31:10 +0100 Subject: [PATCH] Setting SapphireTest::is_running_test() in PHPUnit bootstrap Otherwise conditional logic will only succeed when run through "sake dev/tests", not when run through phpunit directly (which is the recommended way now) --- dev/SapphireTest.php | 3 +++ tests/bootstrap.php | 2 ++ 2 files changed, 5 insertions(+) diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 5e5d75a77..efeb8f842 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -131,6 +131,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase { return self::$is_running_test; } + public static function set_is_running_test($bool) { + self::$is_running_test = $bool; + } /** * Set the manifest to be used to look up test classes by helper functions diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 8e4da445d..bd02b154e 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -61,6 +61,8 @@ $controller = new FakeController(); // Get test manifest TestRunner::use_test_manifest(); +SapphireTest::set_is_running_test(true); + // Remove the error handler so that PHPUnit can add its own restore_error_handler();