Changeset 838 in tests
- Timestamp:
- 07/01/2012 09:42:52 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-testlib/factory.php
r760 r838 6 6 $this->comment = new WP_UnitTest_Factory_For_Comment( $this ); 7 7 $this->user = new WP_UnitTest_Factory_For_User( $this ); 8 if ( is_multisite() ) 9 $this->blog = new WP_UnitTest_Factory_For_Blog( $this ); 8 10 } 9 11 } … … 38 40 $this->default_generation_definitions = array( 39 41 'user_login' => new WP_UnitTest_Generator_Sequence( 'User %s' ), 40 'user_pass' => ' a',42 'user_pass' => 'password', 41 43 'user_email' => new WP_UnitTest_Generator_Sequence( 'user_%s@example.org' ), 42 44 ); … … 79 81 } 80 82 83 class WP_UnitTest_Factory_For_Blog extends WP_UnitTest_Factory_For_Thing { 84 85 function __construct( $factory = null ) { 86 global $current_site; 87 parent::__construct( $factory ); 88 $this->default_generation_definitions = array( 89 'domain' => $current_site->domain, 90 'path' => new WP_UnitTest_Generator_Sequence( 'testpath%s' ), 91 'title' => new WP_UnitTest_Generator_Sequence( 'Site %s' ), 92 'site_id' => $current_site->id, 93 ); 94 } 95 96 function create_object( $args ) { 97 $meta = isset( $args['meta'] ) ? $args['meta'] : array(); 98 $user_id = isset( $args['user_id'] ) ? $args['user_id'] : get_current_user_id(); 99 return wpmu_create_blog( $args['domain'], $args['path'], $args['title'], $user_id, $meta, $args['site_id'] ); 100 } 101 102 function update_object( $blog_id, $fields ) {} 103 } 81 104 82 105 abstract class WP_UnitTest_Factory_For_Thing {
Note: See TracChangeset
for help on using the changeset viewer.