aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-10-22 19:11:18 +0200
committerNils Adermann <naderman@naderman.de>2010-10-25 19:38:35 +0200
commitee846c461c6f0d4ec02dcefa6c82090587bc7012 (patch)
tree7d474e0744a170b92df96329ca2580fdc4ca988c /tests
parentd503272645d0f14daa2c2664e04dbdc33da9379e (diff)
downloadforums-ee846c461c6f0d4ec02dcefa6c82090587bc7012.tar
forums-ee846c461c6f0d4ec02dcefa6c82090587bc7012.tar.gz
forums-ee846c461c6f0d4ec02dcefa6c82090587bc7012.tar.bz2
forums-ee846c461c6f0d4ec02dcefa6c82090587bc7012.tar.xz
forums-ee846c461c6f0d4ec02dcefa6c82090587bc7012.zip
[task/mssql-db-tests] Use a simple getter for test case helpers.
Calling initialisation to then use the member directly seems more complicated than just having a method that returns the instance or creates it if necessary. PHPBB3-9868
Diffstat (limited to 'tests')
-rw-r--r--tests/test_framework/phpbb_database_test_case.php13
-rw-r--r--tests/test_framework/phpbb_test_case.php7
2 files changed, 10 insertions, 10 deletions
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index f6bf420ebc..c183c61f91 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -11,12 +11,14 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
{
protected $test_case_helpers;
- public function init_test_case_helpers()
+ public function get_test_case_helpers()
{
if (!$this->test_case_helpers)
{
$this->test_case_helpers = new phpbb_test_case_helpers($this);
}
+
+ return $this->test_case_helpers;
}
public function get_dbms_data($dbms)
@@ -113,8 +115,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
{
static $already_connected;
- $this->init_test_case_helpers();
- $database_config = $this->test_case_helpers->get_database_config();
+ $database_config = $this->get_test_case_helpers()->get_database_config();
$dbms_data = $this->get_dbms_data($database_config['dbms']);
@@ -189,13 +190,11 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
public function new_dbal()
{
- $this->init_test_case_helpers();
- return $this->test_case_helpers->new_dbal();
+ return $this->get_test_case_helpers()->new_dbal();
}
public function setExpectedTriggerError($errno, $message = '')
{
- $this->init_test_case_helpers();
- $this->test_case_helpers->setExpectedTriggerError($errno, $message);
+ $this->get_test_case_helpers()->setExpectedTriggerError($errno, $message);
}
}
diff --git a/tests/test_framework/phpbb_test_case.php b/tests/test_framework/phpbb_test_case.php
index af867b29ff..fe90d321dc 100644
--- a/tests/test_framework/phpbb_test_case.php
+++ b/tests/test_framework/phpbb_test_case.php
@@ -11,17 +11,18 @@ class phpbb_test_case extends PHPUnit_Framework_TestCase
{
protected $test_case_helpers;
- public function init_test_case_helpers()
+ public function get_test_case_helpers()
{
if (!$this->test_case_helpers)
{
$this->test_case_helpers = new phpbb_test_case_helpers($this);
}
+
+ return $this->test_case_helpers;
}
public function setExpectedTriggerError($errno, $message = '')
{
- $this->init_test_case_helpers();
- $this->test_case_helpers->setExpectedTriggerError($errno, $message);
+ $this->get_test_case_helpers()->setExpectedTriggerError($errno, $message);
}
}