Make WordPress Core

Changeset 1221 in tests for trunk/includes/exceptions.php


Ignore:
Timestamp:
02/28/2013 04:30:21 PM (12 years ago)
Author:
nacin
Message:

During test execution, all wp_die() calls should throw an exception.

If the wp_die() call is not expected, the test will result in an error. Expected wp_die() calls may be caught with $this->setExpectedException( $exception ), @expectedException, etc. For more, see http://www.phpunit.de/manual/3.8/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/exceptions.php

    r903 r1221  
    66
    77/**
    8  * Exception for cases of wp_die()
     8 * General exception for wp_die()
     9 */
     10class WPDieException extends Exception {}
     11
     12/**
     13 * Exception for cases of wp_die(), for ajax tests.
    914 * This means there was an error (no output, and a call to wp_die)
    1015 *
     
    1318 * @since      3.4.0
    1419 */
    15 class WPAjaxDieStopException extends Exception {}
     20class WPAjaxDieStopException extends WPDieException {}
    1621
    1722/**
    18  * Exception for cases of wp_die()
     23 * Exception for cases of wp_die(), for ajax tests.
    1924 * This means execution of the ajax function should be halted, but the unit
    2025 * test can continue.  The function finished normally and there was not an
     
    2631 * @since      3.4.0
    2732 */
    28 class WPAjaxDieContinueException extends Exception {}
     33class WPAjaxDieContinueException extends WPDieException {}
Note: See TracChangeset for help on using the changeset viewer.