From 637362a5b6bfc635c165b8144fb466348cd8e280 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 9 Mar 2015 14:31:19 +0100 Subject: Test: Prefix output with testcase name Signed-off-by: Florian Pritz --- application/tests/Test.php | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'application/tests/Test.php') 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); + } } -- cgit v1.2.3-24-g4f1b