diff --git tests/phpunit/includes/testcase.php tests/phpunit/includes/testcase.php
index e7c3308..c7b13d2 100644
|
|
class WP_UnitTestCase extends PHPUnit_Framework_TestCase { |
17 | 17 | /** |
18 | 18 | * @var WP_UnitTest_Factory |
19 | 19 | */ |
20 | | protected static $factory; |
| 20 | protected static $_factory; |
| 21 | protected $factory; |
21 | 22 | |
22 | 23 | public static function get_called_class() { |
23 | 24 | if ( function_exists( 'get_called_class' ) ) { |
… |
… |
class WP_UnitTestCase extends PHPUnit_Framework_TestCase { |
37 | 38 | public static function setUpBeforeClass() { |
38 | 39 | parent::setUpBeforeClass(); |
39 | 40 | |
40 | | if ( ! self::$factory ) { |
41 | | self::$factory = new WP_UnitTest_Factory(); |
42 | | } |
| 41 | self::_get_factory(); |
43 | 42 | |
44 | 43 | $c = self::get_called_class(); |
45 | 44 | if ( ! method_exists( $c, 'wpSetUpBeforeClass' ) ) { |
… |
… |
class WP_UnitTestCase extends PHPUnit_Framework_TestCase { |
64 | 63 | self::commit_transaction(); |
65 | 64 | } |
66 | 65 | |
| 66 | |
| 67 | protected static function _get_factory() { |
| 68 | if ( ! self::$_factory instanceof WP_UnitTest_Factory ) { |
| 69 | self::$_factory = new WP_UnitTest_Factory(); |
| 70 | } |
| 71 | return self::$_factory; |
| 72 | } |
| 73 | |
| 74 | |
67 | 75 | function setUp() { |
68 | 76 | set_time_limit(0); |
69 | 77 | |
… |
… |
class WP_UnitTestCase extends PHPUnit_Framework_TestCase { |
80 | 88 | $wpdb->show_errors = true; |
81 | 89 | $wpdb->db_connect(); |
82 | 90 | ini_set('display_errors', 1 ); |
| 91 | $this->factory = self::_get_factory(); |
83 | 92 | $this->clean_up_global_scope(); |
84 | 93 | |
85 | 94 | /* |
… |
… |
class WP_UnitTestCase extends PHPUnit_Framework_TestCase { |
682 | 691 | $wp_rewrite->set_permalink_structure( $structure ); |
683 | 692 | $wp_rewrite->flush_rules(); |
684 | 693 | } |
| 694 | |
685 | 695 | } |