- 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
This commit is contained in:
Nils Adermann 2008-11-24 00:24:46 +00:00
parent 07e9b83a3d
commit bcfcf9b048
2 changed files with 35 additions and 0 deletions

View file

@ -0,0 +1,5 @@
<?php
require_once 'PHPUnit/Framework.php';
require_once 'test_framework/phpbb_test_case.php';

View file

@ -0,0 +1,30 @@
<?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);
}
}