Changeset 35242 for trunk/tests/phpunit/includes/testcase.php
- Timestamp:
- 10/17/2015 06:02:16 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/testcase.php
r35225 r35242 15 15 protected static $ignore_files; 16 16 17 /** 18 * @var WP_UnitTest_Factory 19 */ 20 protected static $factory; 17 function __isset( $name ) { 18 return 'factory' === $name; 19 } 20 21 function __get( $name ) { 22 if ( 'factory' === $name ) { 23 return self::factory(); 24 } 25 } 26 27 protected static function factory() { 28 static $factory = null; 29 if ( ! $factory ) { 30 $factory = new WP_UnitTest_Factory(); 31 } 32 return $factory; 33 } 21 34 22 35 public static function get_called_class() { … … 38 51 parent::setUpBeforeClass(); 39 52 40 if ( ! self::$factory ) {41 self::$factory = new WP_UnitTest_Factory();42 }43 44 53 $c = self::get_called_class(); 45 54 if ( ! method_exists( $c, 'wpSetUpBeforeClass' ) ) { … … 47 56 } 48 57 49 call_user_func( array( $c, 'wpSetUpBeforeClass' ), self:: $factory);58 call_user_func( array( $c, 'wpSetUpBeforeClass' ), self::factory() ); 50 59 51 60 self::commit_transaction();
Note: See TracChangeset
for help on using the changeset viewer.