Changeset 46221
- Timestamp:
- 09/20/2019 10:39:23 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/abstract-testcase.php
r46127 r46221 50 50 * Retrieves the name of the class the static method is called in. 51 51 * 52 * @deprecated 5.3.0 Use the PHP native get_called_class() function instead. 53 * 52 54 * @return string The class name. 53 55 */ 54 56 public static function get_called_class() { 55 if ( function_exists( 'get_called_class' ) ) { 56 return get_called_class(); 57 } 58 59 // PHP 5.2 only 60 $backtrace = debug_backtrace(); 61 // [0] WP_UnitTestCase::get_called_class() 62 // [1] WP_UnitTestCase::setUpBeforeClass() 63 if ( 'call_user_func' === $backtrace[2]['function'] ) { 64 return $backtrace[2]['args'][0][0]; 65 } 66 return $backtrace[2]['class']; 57 return get_called_class(); 67 58 } 68 59 … … 80 71 parent::setUpBeforeClass(); 81 72 82 $c = self::get_called_class();73 $c = get_called_class(); 83 74 if ( ! method_exists( $c, 'wpSetUpBeforeClass' ) ) { 84 75 self::commit_transaction(); … … 100 91 self::flush_cache(); 101 92 102 $c = self::get_called_class();93 $c = get_called_class(); 103 94 if ( ! method_exists( $c, 'wpTearDownAfterClass' ) ) { 104 95 self::commit_transaction();
Note: See TracChangeset
for help on using the changeset viewer.