1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-25 12:33:29 +01:00
php-phpbb/tests/test_framework/phpbb_test_case.php
Nils Adermann bcfcf9b048 - added phpBB test framework which is an extension with some additional
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
2008-11-24 00:24:46 +00:00

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);
}
}