[Phpmyadmin-devel] PHPUnit and our error handler
Michal Čihař
michal at cihar.com
Tue Jan 15 08:47:44 CET 2013
Hi
Dne Mon, 14 Jan 2013 13:34:24 -0500
Marc Delisle <marc at infomarc.info> napsal(a):
> Rouslan Placella a écrit :
> Failed asserting that exception of type "PHPUnit_Framework_Error" is
> thrown. See attached patch.
>
>
[..]
> diff --git a/libraries/core.lib.php b/libraries/core.lib.php
> index 93be5fe..eb698ff 100644
> --- a/libraries/core.lib.php
> +++ b/libraries/core.lib.php
> @@ -277,7 +277,12 @@ function PMA_warnMissingExtension($extension, $fatal = false, $extra = '')
> if ($fatal) {
> PMA_fatalError($message);
> } else {
> - trigger_error($message, E_USER_WARNING);
> + $GLOBALS['error_handler']->addError(
> + $message,
> + E_USER_WARNING,
> + '',
> + '',
> + $escape=false);
You no longer trigger PHP error here.
> }
> }
>
> diff --git a/test/libraries/core/PMA_warnMissingExtension_test.php b/test/libraries/core/PMA_warnMissingExtension_test.php
> index 1e11c73..661e6c7 100644
> --- a/test/libraries/core/PMA_warnMissingExtension_test.php
> +++ b/test/libraries/core/PMA_warnMissingExtension_test.php
> @@ -15,6 +15,11 @@ require_once 'libraries/core.lib.php';
> class PMA_warnMissingExtension_test extends PHPUnit_Framework_TestCase
> {
>
> + protected function setUp() {
> + require_once './libraries/Error_Handler.class.php';
> + $GLOBALS['error_handler'] = new PMA_Error_Handler();
> + }
> +
> function testMissingExtention(){
> $ext = 'php_ext';
> $this->setExpectedException('PHPUnit_Framework_Error',
So it can not pop up as en error here. The addError method just adds it
to list of errors in error handle for future display, but that does not
trigger PHP error.
--
Michal Čihař | http://cihar.com | http://blog.cihar.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20130115/82b113f7/attachment.sig>
More information about the Developers
mailing list