Changeset 27178 for trunk/tests/phpunit/includes/factory.php
- Timestamp:
- 02/13/2014 11:06:12 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/includes/factory.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/factory.php
r26252 r27178 42 42 */ 43 43 public $blog; 44 45 /** 46 * @var WP_UnitTest_Factory_For_Network 47 */ 48 public $network; 44 49 45 50 function __construct() { … … 51 56 $this->category = new WP_UnitTest_Factory_For_Term( $this, 'category' ); 52 57 $this->tag = new WP_UnitTest_Factory_For_Term( $this, 'post_tag' ); 53 if ( is_multisite() ) 58 if ( is_multisite() ) { 54 59 $this->blog = new WP_UnitTest_Factory_For_Blog( $this ); 60 $this->network = new WP_UnitTest_Factory_For_Network( $this ); 61 } 55 62 } 56 63 } … … 177 184 } 178 185 186 187 class WP_UnitTest_Factory_For_Network extends WP_UnitTest_Factory_For_Thing { 188 189 function __construct( $factory = null ) { 190 parent::__construct( $factory ); 191 $this->default_generation_definitions = array( 192 'domain' => WP_TESTS_DOMAIN, 193 'title' => new WP_UnitTest_Generator_Sequence( 'Network %s' ), 194 'path' => new WP_UnitTest_Generator_Sequence( '/testpath%s/' ), 195 'network_id' => new WP_UnitTest_Generator_Sequence( '%s', 2 ), 196 'subdomain_install' => false, 197 ); 198 } 199 200 function create_object( $args ) { 201 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 202 203 if ( ! isset( $args['user'] ) ) { 204 $email = WP_TESTS_EMAIL; 205 } else { 206 $email = get_userdata( $args['user'] )->user_email; 207 } 208 209 populate_network( $args['network_id'], $args['domain'], $email, $args['title'], $args['path'], $args['subdomain_install'] ); 210 return $args['network_id']; 211 } 212 213 function update_object( $network_id, $fields ) {} 214 215 function get_object_by_id( $network_id ) { 216 return wp_get_network( $network_id ); 217 } 218 } 179 219 180 220 class WP_UnitTest_Factory_For_Term extends WP_UnitTest_Factory_For_Thing {
Note: See TracChangeset
for help on using the changeset viewer.