diff options
author | Florian Pritz <bluewind@xinu.at> | 2015-03-09 14:31:19 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-03-09 14:31:19 +0100 |
commit | 637362a5b6bfc635c165b8144fb466348cd8e280 (patch) | |
tree | cfeeda7641f18cce3bec99c711edaf65feeae154 /application | |
parent | 9cff09180700479b2618d4908aa2877e03404564 (diff) |
Test: Prefix output with testcase name
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-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); + } } |