test_case = $test_case; } public function setExpectedTriggerError($errno, $message = '') { $exceptionName = ''; switch ($errno) { case E_NOTICE: case E_STRICT: 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'; break; default: $exceptionName = 'PHPUnit_Framework_Error'; break; } $this->expectedTriggerError = true; $this->test_case->setExpectedException($exceptionName, (string) $message, $errno); } public function makedirs($path) { mkdir($path, 0777, true); } static public function get_test_config() { $config = array(); if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>=')) { $config = array_merge($config, array( 'dbms' => 'sqlite', 'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite2', // filename 'dbport' => '', 'dbname' => '', 'dbuser' => '', 'dbpasswd' => '', )); } if (file_exists(dirname(__FILE__) . '/../test_config.php')) { include(dirname(__FILE__) . '/../test_config.php'); $config = array_merge($config, array( 'dbms' => $dbms, 'dbhost' => $dbhost, 'dbport' => $dbport, 'dbname' => $dbname, 'dbuser' => $dbuser, 'dbpasswd' => $dbpasswd, )); if (isset($phpbb_functional_url)) { $config['phpbb_functional_url'] = $phpbb_functional_url; } } if (isset($_SERVER['PHPBB_TEST_DBMS'])) { $config = array_merge($config, array( 'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? $_SERVER['PHPBB_TEST_DBMS'] : '', 'dbhost' => isset($_SERVER['PHPBB_TEST_DBHOST']) ? $_SERVER['PHPBB_TEST_DBHOST'] : '', 'dbport' => isset($_SERVER['PHPBB_TEST_DBPORT']) ? $_SERVER['PHPBB_TEST_DBPORT'] : '', 'dbname' => isset($_SERVER['PHPBB_TEST_DBNAME']) ? $_SERVER['PHPBB_TEST_DBNAME'] : '', 'dbuser' => isset($_SERVER['PHPBB_TEST_DBUSER']) ? $_SERVER['PHPBB_TEST_DBUSER'] : '', 'dbpasswd' => isset($_SERVER['PHPBB_TEST_DBPASSWD']) ? $_SERVER['PHPBB_TEST_DBPASSWD'] : '' )); } if (isset($_SERVER['PHPBB_FUNCTIONAL_URL'])) { $config = array_merge($config, array( 'phpbb_functional_url' => isset($_SERVER['PHPBB_FUNCTIONAL_URL']) ? $_SERVER['PHPBB_FUNCTIONAL_URL'] : '', )); } return $config; } }