mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 12:03:21 +01:00
Tests are run with sqlite by default now anyway, so in the majority of cases the error message explaining how to set up database test running will not be displayed anyway. Database tests are now generally simply skipped if no configuration can be found. The RUNNING_TESTS.txt file explains how to set them up however, and more info is available on the wiki. The get_database_config method was moved from test_case_helpers to database_test_case because it has no general purpose. PHPBB3-9868
45 lines
937 B
PHP
45 lines
937 B
PHP
<?php
|
|
/**
|
|
*
|
|
* @package testing
|
|
* @copyright (c) 2008 phpBB Group
|
|
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
*
|
|
*/
|
|
|
|
class phpbb_test_case_helpers
|
|
{
|
|
protected $expectedTriggerError = false;
|
|
|
|
protected $test_case;
|
|
|
|
public function __construct($test_case)
|
|
{
|
|
$this->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);
|
|
}
|
|
}
|