mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-26 20:08:55 +00:00
[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
This commit is contained in:
parent
d503272645
commit
ee846c461c
2 changed files with 10 additions and 10 deletions
|
@ -11,12 +11,14 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||||
{
|
{
|
||||||
protected $test_case_helpers;
|
protected $test_case_helpers;
|
||||||
|
|
||||||
public function init_test_case_helpers()
|
public function get_test_case_helpers()
|
||||||
{
|
{
|
||||||
if (!$this->test_case_helpers)
|
if (!$this->test_case_helpers)
|
||||||
{
|
{
|
||||||
$this->test_case_helpers = new phpbb_test_case_helpers($this);
|
$this->test_case_helpers = new phpbb_test_case_helpers($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->test_case_helpers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_dbms_data($dbms)
|
public function get_dbms_data($dbms)
|
||||||
|
@ -113,8 +115,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
|
||||||
{
|
{
|
||||||
static $already_connected;
|
static $already_connected;
|
||||||
|
|
||||||
$this->init_test_case_helpers();
|
$database_config = $this->get_test_case_helpers()->get_database_config();
|
||||||
$database_config = $this->test_case_helpers->get_database_config();
|
|
||||||
|
|
||||||
$dbms_data = $this->get_dbms_data($database_config['dbms']);
|
$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()
|
public function new_dbal()
|
||||||
{
|
{
|
||||||
$this->init_test_case_helpers();
|
return $this->get_test_case_helpers()->new_dbal();
|
||||||
return $this->test_case_helpers->new_dbal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setExpectedTriggerError($errno, $message = '')
|
public function setExpectedTriggerError($errno, $message = '')
|
||||||
{
|
{
|
||||||
$this->init_test_case_helpers();
|
$this->get_test_case_helpers()->setExpectedTriggerError($errno, $message);
|
||||||
$this->test_case_helpers->setExpectedTriggerError($errno, $message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,17 +11,18 @@ class phpbb_test_case extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected $test_case_helpers;
|
protected $test_case_helpers;
|
||||||
|
|
||||||
public function init_test_case_helpers()
|
public function get_test_case_helpers()
|
||||||
{
|
{
|
||||||
if (!$this->test_case_helpers)
|
if (!$this->test_case_helpers)
|
||||||
{
|
{
|
||||||
$this->test_case_helpers = new phpbb_test_case_helpers($this);
|
$this->test_case_helpers = new phpbb_test_case_helpers($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->test_case_helpers;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setExpectedTriggerError($errno, $message = '')
|
public function setExpectedTriggerError($errno, $message = '')
|
||||||
{
|
{
|
||||||
$this->init_test_case_helpers();
|
$this->get_test_case_helpers()->setExpectedTriggerError($errno, $message);
|
||||||
$this->test_case_helpers->setExpectedTriggerError($errno, $message);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue