Make WordPress Core

Changeset 30786


Ignore:
Timestamp:
12/08/2014 02:32:53 AM (10 years ago)
Author:
jeremyfelt
Message:

Clean up factory arguments in ms-sites group.

  • Arguments for user, path, and title are only necessary when we need to do something with those arguments later. Most cases in the ms-sites group do not require them.
  • In test_get_blog_id_from_url_is_case_insensitive(), we should pass a lowercase domain argument.
  • A user factory in test_switch_restore_blog() is not necessary.

See #30080

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/multisite/site.php

    r30785 r30786  
    3737        $this->assertEquals( $current_blog_id, wp_cache_get( 'switch-test', 'switch-test' ) );
    3838
    39         $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
    40         $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id, 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
     39        $blog_id = $this->factory->blog->create();
    4140
    4241        $cap_key = wp_get_current_user()->cap_key;
     
    336335   
    337336    function test_update_blog_details() {
    338         $blog_id = $this->factory->blog->create( array( 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
     337        $blog_id = $this->factory->blog->create();
    339338
    340339        $result = update_blog_details( $blog_id, array( 'domain' => 'example.com', 'path' => 'my_path/' ) );
     
    353352        $test_action_counter = 0;
    354353
    355         $blog_id = $this->factory->blog->create( array( 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
     354        $blog_id = $this->factory->blog->create();
    356355        update_blog_details( $blog_id, array( 'spam' => 1 ) );
    357356
     
    377376        $test_action_counter = 0;
    378377
    379         $blog_id = $this->factory->blog->create( array( 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
     378        $blog_id = $this->factory->blog->create();
    380379
    381380        add_action( 'make_spam_blog', array( $this, '_action_counter_cb' ), 10 );
     
    400399        $test_action_counter = 0;
    401400
    402         $blog_id = $this->factory->blog->create( array( 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
     401        $blog_id = $this->factory->blog->create();
    403402
    404403        add_action( 'archive_blog', array( $this, '_action_counter_cb' ), 10 );
     
    423422        $test_action_counter = 0;
    424423
    425         $blog_id = $this->factory->blog->create( array( 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
     424        $blog_id = $this->factory->blog->create();
    426425        update_blog_details( $blog_id, array( 'archived' => 1 ) );
    427426
     
    446445        $test_action_counter = 0;
    447446
    448         $blog_id = $this->factory->blog->create( array( 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
     447        $blog_id = $this->factory->blog->create();
    449448
    450449        add_action( 'make_delete_blog', array( $this, '_action_counter_cb' ), 10 );
     
    469468        $test_action_counter = 0;
    470469
    471         $blog_id = $this->factory->blog->create( array( 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
     470        $blog_id = $this->factory->blog->create();
    472471        update_blog_details( $blog_id, array( 'deleted' => 1 ) );
    473472
     
    493492        $test_action_counter = 0;
    494493
    495         $blog_id = $this->factory->blog->create( array( 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
     494        $blog_id = $this->factory->blog->create();
    496495
    497496        add_action( 'mature_blog', array( $this, '_action_counter_cb' ), 10 );
     
    516515        $test_action_counter = 0;
    517516
    518         $blog_id = $this->factory->blog->create( array( 'path' => '/test_blogpath', 'title' => 'Test Title' ) );
     517        $blog_id = $this->factory->blog->create();
    519518        update_blog_details( $blog_id, array( 'mature' => 1 ) );
    520519
     
    994993     */
    995994    function test_get_blog_id_from_url() {
    996         $blog_id = $this->factory->blog->create( array( 'path' => '/xyz', 'title' => 'Test Title' ) );
     995        $blog_id = $this->factory->blog->create();
    997996        $details = get_blog_details( $blog_id, false );
    998997        $key = md5( $details->domain . $details->path );
     
    10071006     */
    10081007    function test_get_blog_id_from_url_is_case_insensitive() {
    1009         $blog_id = $this->factory->blog->create( array( 'path' => '/xyz', 'title' => 'Test Title' ) );
     1008        $blog_id = $this->factory->blog->create( array( 'domain' => 'example.com', 'path' => '/xyz' ) );
    10101009        $details = get_blog_details( $blog_id, false );
    10111010
     
    10171016     */
    10181017    function test_get_blog_id_from_url_that_does_not_exist() {
    1019         $blog_id = $this->factory->blog->create( array( 'path' => '/xyz', 'title' => 'Test Title' ) );
     1018        $blog_id = $this->factory->blog->create( array( 'path' => '/xyz' ) );
    10201019        $details = get_blog_details( $blog_id, false );
    10211020
     
    10291028     */
    10301029    function test_get_blog_id_from_url_with_deleted_flag() {
    1031         $blog_id = $this->factory->blog->create( array( 'path' => '/xyz', 'title' => 'Test Title' ) );
     1030        $blog_id = $this->factory->blog->create();
    10321031        $details = get_blog_details( $blog_id, false );
    10331032        $key = md5( $details->domain . $details->path );
     
    10431042     */
    10441043    function test_get_blog_id_from_url_after_dropped() {
    1045         $blog_id = $this->factory->blog->create( array( 'path' => '/xyz', 'title' => 'Test Title' ) );
     1044        $blog_id = $this->factory->blog->create();
    10461045        $details = get_blog_details( $blog_id, false );
    10471046        $key = md5( $details->domain . $details->path );
     
    11001099        $this->assertEquals( '', $info['error'] );
    11011100
    1102         $user_id = $this->factory->user->create( array( 'role' => 'administrator' ) );
    1103         $blog_id = $this->factory->blog->create( array( 'user_id' => $user_id ) );
     1101        $blog_id = $this->factory->blog->create();
    11041102
    11051103        switch_to_blog( $blog_id );
Note: See TracChangeset for help on using the changeset viewer.