mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-08 08:35:31 +02:00
45 lines
944 B
PHP
45 lines
944 B
PHP
<?php
|
|
/**
|
|
*
|
|
* @package testing
|
|
* @copyright (c) 2008 phpBB Group
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
|
*
|
|
*/
|
|
|
|
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);
|
|
}
|
|
}
|