2010-03-26 16:39:37 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @package testing
|
|
|
|
* @copyright (c) 2008 phpBB Group
|
2011-12-31 16:05:02 +00:00
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
2010-03-26 16:39:37 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
class phpbb_test_case_helpers
|
|
|
|
{
|
|
|
|
protected $expectedTriggerError = false;
|
|
|
|
|
|
|
|
protected $test_case;
|
|
|
|
|
|
|
|
public function __construct($test_case)
|
|
|
|
{
|
|
|
|
$this->test_case = $test_case;
|
|
|
|
}
|
|
|
|
|
|
|
|
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->test_case->setExpectedException($exceptionName, (string) $message, $errno);
|
|
|
|
}
|
|
|
|
}
|