aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_framework/phpbb_test_case_helpers.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_framework/phpbb_test_case_helpers.php')
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php45
1 files changed, 38 insertions, 7 deletions
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index c792976b1e..9a2ea275d0 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -81,21 +81,26 @@ class phpbb_test_case_helpers
{
case E_NOTICE:
case E_STRICT:
- PHPUnit_Framework_Error_Notice::$enabled = true;
- $exceptionName = 'PHPUnit_Framework_Error_Notice';
+ PHPUnit\Framework\Error\Notice::$enabled = true;
+ $exceptionName = 'PHPUnit\Framework\Error\Notice';
break;
case E_WARNING:
- PHPUnit_Framework_Error_Warning::$enabled = true;
- $exceptionName = 'PHPUnit_Framework_Error_Warning';
+ PHPUnit\Framework\Error\Warning::$enabled = true;
+ $exceptionName = 'PHPUnit\Framework\Error\Warning';
break;
default:
- $exceptionName = 'PHPUnit_Framework_Error';
+ $exceptionName = 'PHPUnit\Framework\Error\Error';
break;
}
$this->expectedTriggerError = true;
- $this->test_case->setExpectedException($exceptionName, (string) $message, $errno);
+ $this->test_case->expectException($exceptionName);
+ $this->test_case->expectExceptionCode($errno);
+ if ($message)
+ {
+ $this->test_case->expectExceptionMessage((string) $message);
+ }
}
public function makedirs($path)
@@ -168,6 +173,16 @@ class phpbb_test_case_helpers
{
$config['fulltext_sphinx_id'] = $fulltext_sphinx_id;
}
+
+ if (isset($phpbb_memcached_host))
+ {
+ $config['memcached_host'] = $phpbb_memcached_host;
+ }
+
+ if (isset($phpbb_memcached_port))
+ {
+ $config['memcached_port'] = $phpbb_memcached_port;
+ }
}
if (isset($_SERVER['PHPBB_TEST_DBMS']))
@@ -200,6 +215,16 @@ class phpbb_test_case_helpers
$config['redis_port'] = $_SERVER['PHPBB_TEST_REDIS_PORT'];
}
+ if (isset($_SERVER['PHPBB_TEST_MEMCACHED_HOST']))
+ {
+ $config['memcached_host'] = $_SERVER['PHPBB_TEST_MEMCACHED_HOST'];
+ }
+
+ if (isset($_SERVER['PHPBB_TEST_MEMCACHED_PORT']))
+ {
+ $config['memcached_port'] = $_SERVER['PHPBB_TEST_MEMCACHED_PORT'];
+ }
+
return $config;
}
@@ -382,10 +407,16 @@ class phpbb_test_case_helpers
}
// Mock the DAL, make it return data from the fixture
+ $db_driver = $this->test_case->getMockBuilder('phpbb\\db\\driver\\driver')
+ ->disableOriginalConstructor()
+ ->disableOriginalClone()
+ ->disableArgumentCloning()
+ ->disallowMockingUnknownTypes()
+ ->getMock();
$mb = $this->test_case->getMockBuilder('phpbb\\textformatter\\data_access');
$mb->setMethods(array('get_bbcodes', 'get_censored_words', 'get_smilies', 'get_styles'));
$mb->setConstructorArgs(array(
- $this->test_case->getMockBuilder('phpbb\\db\\driver\\driver')->getMock(),
+ $db_driver,
'phpbb_bbcodes',
'phpbb_smilies',
'phpbb_styles',