mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-25 12:33:29 +01:00
functionality of PHPUnit - first addition: setExpectedTriggerError() if a test expects a call to trigger_error(). git-svn-id: file:///svn/phpbb/trunk@9103 89ea8834-ac86-4346-8a33-228a782c2dd0
30 lines
706 B
PHP
30 lines
706 B
PHP
<?php
|
|
|
|
class phpbb_test_case extends PHPUnit_Framework_TestCase
|
|
{
|
|
protected $expectedTriggerError = false;
|
|
|
|
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->setExpectedException($exceptionName, (string) $message, $errno);
|
|
}
|
|
} |