mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
[develop-olympus] Backported 3.1 unit tests to 3.0.
Start adding unit tests for bugs you fix! Tests for anything are welcome really. We have to work on these a lot.
This commit is contained in:
37
tests/test_framework/phpbb_test_case.php
Normal file
37
tests/test_framework/phpbb_test_case.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package testing
|
||||
* @copyright (c) 2008 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
||||
*
|
||||
*/
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user