diff options
-rw-r--r-- | application/controllers/tools.php | 1 | ||||
-rw-r--r-- | application/tests/Test.php | 21 |
2 files changed, 20 insertions, 2 deletions
diff --git a/application/controllers/tools.php b/application/controllers/tools.php index 7c8538cfb..ca79ba004 100644 --- a/application/controllers/tools.php +++ b/application/controllers/tools.php @@ -80,6 +80,7 @@ class Tools extends MY_Controller { foreach ($refl->getMethods() as $method) { if (strpos($method->name, "test_") === 0) { try { + $test->setTestNamePrefix($method->name." - "); $test->init(); $test->{$method->name}(); $test->cleanup(); diff --git a/application/tests/Test.php b/application/tests/Test.php index 1f2e4fefa..b9f401bdf 100644 --- a/application/tests/Test.php +++ b/application/tests/Test.php @@ -9,14 +9,27 @@ namespace tests; +require_once APPPATH."/third_party/test-more-php/Test-More-OO.php"; + +class TestMore extends \TestMore { + private $TestNamePrefix = ""; + + public function setTestNamePrefix($prefix) { + $this->TestNamePrefix = $prefix; + } + + public function ok ($Result = NULL, $TestName = NULL) { + return parent::ok($Result, $this->TestNamePrefix.$TestName); + } +} + abstract class Test { protected $t; protected $server = ""; public function __construct() { - require_once APPPATH."/third_party/test-more-php/Test-More-OO.php"; - $this->t = new \TestMore(); + $this->t = new TestMore(); $this->t->plan("no_plan"); } @@ -106,4 +119,8 @@ abstract class Test { { $this->t->done_testing(); } + + public function setTestNamePrefix($prefix) { + $this->t->setTestNamePrefix($prefix); + } } |