mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
- 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:
parent
07e9b83a3d
commit
bcfcf9b048
2 changed files with 35 additions and 0 deletions
5
tests/test_framework/framework.php
Normal file
5
tests/test_framework/framework.php
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'PHPUnit/Framework.php';
|
||||||
|
|
||||||
|
require_once 'test_framework/phpbb_test_case.php';
|
30
tests/test_framework/phpbb_test_case.php
Normal file
30
tests/test_framework/phpbb_test_case.php
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue