Make WordPress Core

Changeset 35188


Ignore:
Timestamp:
10/15/2015 05:29:40 AM (11 years ago)
Author:
wonderboymusic
Message:

Unit Tests: create more fixtures for Tests_User. When using a factory to create ad hoc users, use the inherited static prop $static_factory instead of the instance prop, $factory. If 2 factories are used out of sync, the generator sequences diverge and dupes can be created, causing an untold number of unforeseen errors. Yay.

See #30017, #33968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user.php

    r35116 r35188  
    66 */
    77class Tests_User extends WP_UnitTestCase {
    8 
     8        protected static $test_id;
     9        protected static $author_id;
     10        protected static $_author;
     11        protected $author;
    912        protected $user_data;
    1013
    11         function setUp() {
    12                 parent::setUp();
    13 
    14                 $this->user_data = array(
     14        public static function wpSetUpBeforeClass( $factory ) {
     15                self::$test_id = $factory->user->create( array(
    1516                        'user_login' => 'user1',
    1617                        'user_nicename' => 'userone',
    … …  
    2122                        'user_email' => 'blackburn@battlefield3.com',
    2223                        'user_url' => 'http://tacos.com'
    23                 );
     24                ) );
     25                self::$author_id = $factory->user->create( array( 'role' => 'author' ) );
     26                self::$_author = get_user_by( 'ID', self::$author_id );
     27        }
     28
     29        public static function wpTearDownAfterClass() {
     30                $ids = array( self::$test_id, self::$author_id );
     31                foreach ( $ids as $id ) {
     32                        if ( is_multisite() ) {
     33                                wpmu_delete_user( $id );
     34                        } else {
     35                                wp_delete_user( $id );
     36                        }
     37                }
     38        }
     39
     40        function setUp() {
     41                parent::setUp();
     42
     43                $this->author = clone self::$_author;
    2444        }
    2545
    … …  
    2848                $nusers = array();
    2949                foreach ( array('administrator', 'editor', 'author', 'contributor', 'subscriber' ) as $role ) {
    30                         $id = $this->factory->user->create( array( 'role' => $role ) );
     50                        $id = self::$static_factory->user->create( array( 'role' => $role ) );
    3151                        $nusers[ $id ] = $id;
    3252                }
    … …  
    5272                $val = rand_str();
    5373
    54                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
    55 
    5674                // get an option that doesn't exist
    57                 $this->assertFalse(get_user_option($key, $user_id));
     75                $this->assertFalse( get_user_option( $key, self::$author_id ) );
    5876
    5977                // set and get
    60                 update_user_option( $user_id, $key, $val );
    61                 $this->assertEquals( $val, get_user_option($key, $user_id) );
     78                update_user_option( self::$author_id, $key, $val );
     79                $this->assertEquals( $val, get_user_option( $key, self::$author_id ) );
    6280
    6381                // change and get again
    6482                $val2 = rand_str();
    65                 update_user_option( $user_id, $key, $val2 );
    66                 $this->assertEquals( $val2, get_user_option($key, $user_id) );
    67 
     83                update_user_option( self::$author_id, $key, $val2 );
     84                $this->assertEquals( $val2, get_user_option( $key, self::$author_id ) );
    6885        }
    6986
    7087        // simple tests for usermeta functions
    7188        function test_usermeta() {
    72 
    7389                $key = rand_str();
    7490                $val = rand_str();
    7591
    76                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
    77 
    7892                // get a meta key that doesn't exist
    79                 $this->assertEquals( '', get_user_meta($user_id, $key, true));
     93                $this->assertEquals( '', get_user_meta( self::$author_id, $key, true ) );
    8094
    8195                // set and get
    82                 update_user_meta( $user_id, $key, $val );
    83                 $this->assertEquals( $val, get_user_meta($user_id, $key, true) );
     96                update_user_meta( self::$author_id, $key, $val );
     97                $this->assertEquals( $val, get_user_meta( self::$author_id, $key, true ) );
    8498
    8599                // change and get again
    86100                $val2 = rand_str();
    87                 update_user_meta( $user_id, $key, $val2 );
    88                 $this->assertEquals( $val2, get_user_meta($user_id, $key, true) );
     101                update_user_meta( self::$author_id, $key, $val2 );
     102                $this->assertEquals( $val2, get_user_meta( self::$author_id, $key, true ) );
    89103
    90104                // delete and get
    91                 delete_user_meta( $user_id, $key );
    92                 $this->assertEquals( '', get_user_meta($user_id, $key, true) );
     105                delete_user_meta( self::$author_id, $key );
     106                $this->assertEquals( '', get_user_meta( self::$author_id, $key, true ) );
    93107
    94108                // delete by key AND value
    95                 update_user_meta( $user_id, $key, $val );
     109                update_user_meta( self::$author_id, $key, $val );
    96110                // incorrect key: key still exists
    97                 delete_user_meta( $user_id, $key, rand_str() );
    98                 $this->assertEquals( $val, get_user_meta($user_id, $key, true) );
     111                delete_user_meta( self::$author_id, $key, rand_str() );
     112                $this->assertEquals( $val, get_user_meta( self::$author_id, $key, true ) );
    99113                // correct key: deleted
    100                 delete_user_meta( $user_id, $key, $val );
    101                 $this->assertEquals( '', get_user_meta($user_id, $key, true) );
     114                delete_user_meta( self::$author_id, $key, $val );
     115                $this->assertEquals( '', get_user_meta( self::$author_id, $key, true ) );
    102116
    103117        }
    … …  
    112126                );
    113127
    114                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
    115 
    116128                // there is already some stuff in the array
    117                 $this->assertTrue(is_array(get_user_meta($user_id)));
    118 
    119                 foreach ($vals as $k=>$v)
    120                         update_user_meta( $user_id, $k, $v );
    121 
     129                $this->assertTrue( is_array( get_user_meta( self::$author_id ) ) );
     130
     131                foreach ( $vals as $k => $v ) {
     132                        update_user_meta( self::$author_id, $k, $v );
     133                }
    122134                // get the complete usermeta array
    123                 $out = get_user_meta($user_id);
     135                $out = get_user_meta( self::$author_id );
    124136
    125137                // for reasons unclear, the resulting array is indexed numerically; meta keys are not included anywhere.
    126138                // so we'll just check to make sure our values are included somewhere.
    127                 foreach ($vals as $k=>$v)
    128                         $this->assertTrue(isset($out[$k]) && $out[$k][0] == $v);
    129 
     139                foreach ( $vals as $k => $v ) {
     140                        $this->assertTrue( isset( $out[$k] ) && $out[$k][0] == $v );
     141                }
    130142                // delete one key and check again
    131143                $keys = array_keys( $vals );
    132144                $key_to_delete = array_pop( $keys );
    133                 delete_user_meta($user_id, $key_to_delete);
    134                 $out = get_user_meta($user_id);
     145                delete_user_meta( self::$author_id, $key_to_delete );
     146                $out = get_user_meta( self::$author_id );
    135147                // make sure that key is excluded from the results
    136148                foreach ($vals as $k=>$v) {
    137                         if ($k == $key_to_delete)
    138                                 $this->assertFalse(isset($out[$k]));
    139                         else
    140                         $this->assertTrue(isset($out[$k]) && $out[$k][0] == $v);
     149                        if ($k == $key_to_delete) {
     150                                $this->assertFalse( isset( $out[$k] ) );
     151                        } else {
     152                                $this->assertTrue( isset( $out[$k] ) && $out[$k][0] == $v );
     153                        }
    141154                }
    142155        }
    … …  
    144157        // Test property magic functions for property get/set/isset.
    145158        function test_user_properties() {
    146                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
    147                 $user = new WP_User( $user_id );
     159                $user = new WP_User( self::$author_id );
    148160
    149161                foreach ( $user->data as $key => $data ) {
    … …  
    169181         */
    170182        public function test_user_unset() {
    171                 // New user
    172                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
    173                 $user = new WP_User( $user_id );
     183                $user = new WP_User( self::$author_id );
    174184
    175185                // Test custom fields
    … …  
    205215        // Test meta property magic functions for property get/set/isset.
    206216        function test_user_meta_properties() {
    207                 global $wpdb;
    208 
    209                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
    210                 $user = new WP_User( $user_id );
    211 
    212                 update_user_option( $user_id, 'foo', 'foo', true );
     217                $user = new WP_User( self::$author_id );
     218
     219                update_user_option( self::$author_id, 'foo', 'foo', true );
    213220
    214221                $this->assertTrue( isset( $user->foo ) );
    … …  
    221228         */
    222229        function test_id_property_back_compat() {
    223                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
    224                 $user = new WP_User( $user_id );
     230                $user = new WP_User( self::$author_id );
    225231
    226232                $this->assertTrue( isset( $user->id ) );
    … …  
    243249
    244250                foreach ( $roles as $role => $level ) {
    245                         $user_id = $this->factory->user->create( array( 'role' => $role ) );
     251                        $user_id = self::$static_factory->user->create( array( 'role' => $role ) );
    246252                        $user = new WP_User( $user_id );
    247253
    … …  
    252258
    253259        function test_construction() {
    254                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
    255 
    256                 $user = new WP_User( $user_id );
     260                $user = new WP_User( self::$author_id );
    257261                $this->assertInstanceOf( 'WP_User', $user );
    258                 $this->assertEquals( $user_id, $user->ID );
     262                $this->assertEquals( self::$author_id, $user->ID );
    259263
    260264                $user2 = new WP_User( 0,  $user->user_login );
    261265                $this->assertInstanceOf( 'WP_User', $user2 );
    262                 $this->assertEquals( $user_id, $user2->ID );
     266                $this->assertEquals( self::$author_id, $user2->ID );
    263267                $this->assertEquals( $user->user_login, $user2->user_login );
    264268
    … …  
    269273
    270274                $user3->init( $user->data );
    271                 $this->assertEquals( $user_id, $user3->ID );
     275                $this->assertEquals( self::$author_id, $user3->ID );
    272276
    273277                $user4 = new WP_User( $user->user_login );
    274278                $this->assertInstanceOf( 'WP_User', $user4 );
    275                 $this->assertEquals( $user_id, $user4->ID );
     279                $this->assertEquals( self::$author_id, $user4->ID );
    276280                $this->assertEquals( $user->user_login, $user4->user_login );
    277281
    278282                $user5 = new WP_User( null, $user->user_login );
    279283                $this->assertInstanceOf( 'WP_User', $user5 );
    280                 $this->assertEquals( $user_id, $user5->ID );
     284                $this->assertEquals( self::$author_id, $user5->ID );
    281285                $this->assertEquals( $user->user_login, $user5->user_login );
    282286
    283287                $user6 = new WP_User( $user );
    284288                $this->assertInstanceOf( 'WP_User', $user6 );
    285                 $this->assertEquals( $user_id, $user6->ID );
     289                $this->assertEquals( self::$author_id, $user6->ID );
    286290                $this->assertEquals( $user->user_login, $user6->user_login );
    287291
    288292                $user7 = new WP_User( $user->data );
    289293                $this->assertInstanceOf( 'WP_User', $user7 );
    290                 $this->assertEquals( $user_id, $user7->ID );
     294                $this->assertEquals( self::$author_id, $user7->ID );
    291295                $this->assertEquals( $user->user_login, $user7->user_login );
    292296        }
    293297
    294298        function test_get() {
    295                 $user_id = $this->factory->user->create( array(
     299                $user_id = self::$static_factory->user->create( array(
    296300                        'role' => 'author',
    297301                        'user_login' => 'test_wp_user_get',
    … …  
    311315
    312316        function test_has_prop() {
    313                 $user_id = $this->factory->user->create( array(
     317                $user_id = self::$static_factory->user->create( array(
    314318                        'role' => 'author',
    315319                        'user_login' => 'test_wp_user_has_prop',
    … …  
    328332
    329333        function test_update_user() {
    330                 $user_id = $this->factory->user->create( array(
     334                $user_id = self::$static_factory->user->create( array(
    331335                        'role' => 'author',
    332336                        'user_login' => 'test_wp_update_user',
    … …  
    364368
    365369                // Test update of fields in _get_additional_user_keys()
    366                 $user_data = array( 'ID' => $user_id, 'use_ssl' => 1, 'show_admin_bar_front' => 1,
    367                                                    'rich_editing' => 1, 'first_name' => 'first', 'last_name' => 'last',
    368                                                    'nickname' => 'nick', 'comment_shortcuts' => 'true', 'admin_color' => 'classic',
    369                                                    'description' => 'describe' );
     370                $user_data = array(
     371                        'ID' => $user_id, 'use_ssl' => 1, 'show_admin_bar_front' => 1,
     372                        'rich_editing' => 1, 'first_name' => 'first', 'last_name' => 'last',
     373                        'nickname' => 'nick', 'comment_shortcuts' => 'true', 'admin_color' => 'classic',
     374                        'description' => 'describe'
     375                );
    370376                wp_update_user( $user_data );
    371377
    372378                $user = new WP_User( $user_id );
    373                 foreach ( $user_data as $key => $value )
     379                foreach ( $user_data as $key => $value ) {
    374380                        $this->assertEquals( $value, $user->get( $key ), $key );
     381                }
    375382        }
    376383
    … …  
    381388                global $userdata, $wpdb;
    382389
    383                 $user_id = $this->factory->user->create( array( 'role' => 'subscriber' ) );
     390                $user_id = self::$static_factory->user->create( array( 'role' => 'subscriber' ) );
    384391                wp_set_current_user( $user_id );
    385392
    … …  
    397404        function test_global_userdata_is_null_when_logged_out() {
    398405                global $userdata;
    399                 wp_set_current_user(0);
     406                wp_set_current_user( 0 );
    400407                $this->assertNull( $userdata );
    401408        }
    402409
    403410        function test_exists() {
    404                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
    405                 $user = new WP_User( $user_id );
     411                $user = new WP_User( self::$author_id );
    406412
    407413                $this->assertTrue( $user->exists() );
    … …  
    421427                $old_post_id = $id;
    422428
    423                 $user_id = $this->factory->user->create( array( 'role' => 'author' ) );
    424                 $user = new WP_User( $user_id );
     429                $user = new WP_User( self::$author_id );
    425430
    426431                $post = array(
    427                         'post_author' => $user_id,
     432                        'post_author' => self::$author_id,
    428433                        'post_status' => 'publish',
    429434                        'post_content' => rand_str(),
    … …  
    440445                $this->assertNotEmpty( $authordata );
    441446                $this->assertInstanceOf( 'WP_User', $authordata );
    442                 $this->assertEquals( $authordata->ID, $user_id );
    443 
    444                 if ( $old_post_id )
     447                $this->assertEquals( $authordata->ID, self::$author_id );
     448
     449                if ( $old_post_id ) {
    445450                        setup_postdata( get_post( $old_post_id ) );
     451                }
    446452        }
    447453
    … …  
    457463
    458464        function test_user_get_data_by_id() {
    459                 $user_id   = $this->factory->user->create();
    460 
    461                 $user = WP_User::get_data_by( 'id', $user_id );
     465                $user = WP_User::get_data_by( 'id', self::$author_id );
    462466                $this->assertInstanceOf( 'stdClass', $user );
    463                 $this->assertEquals( $user_id, $user->ID );
     467                $this->assertEquals( self::$author_id, $user->ID );
    464468
    465469                // @ticket 23480
    466                 $user = WP_User::get_data_by( 'id', -1 );
    467                 $this->assertEquals( false, $user );
    468 
    469                 $user = WP_User::get_data_by( 'id', 0 );
    470                 $this->assertEquals( false, $user );
    471 
    472                 $user = WP_User::get_data_by( 'id', null );
    473                 $this->assertEquals( false, $user );
    474 
    475                 $user = WP_User::get_data_by( 'id', '' );
    476                 $this->assertEquals( false, $user );
    477 
    478                 $user = WP_User::get_data_by( 'id', false );
    479                 $this->assertEquals( false, $user );
    480 
    481                 $user = WP_User::get_data_by( 'id', @$user->user_nicename );
    482                 $this->assertEquals( false, $user );
    483 
    484                 $user = WP_User::get_data_by( 'id', 99999 );
    485                 $this->assertEquals( false, $user );
     470                $user1 = WP_User::get_data_by( 'id', -1 );
     471                $this->assertEquals( false, $user1 );
     472
     473                $user2 = WP_User::get_data_by( 'id', 0 );
     474                $this->assertEquals( false, $user2 );
     475
     476                $user3 = WP_User::get_data_by( 'id', null );
     477                $this->assertEquals( false, $user3 );
     478
     479                $user4 = WP_User::get_data_by( 'id', '' );
     480                $this->assertEquals( false, $user4 );
     481
     482                $user5 = WP_User::get_data_by( 'id', false );
     483                $this->assertEquals( false, $user5 );
     484
     485                $user6 = WP_User::get_data_by( 'id', $user->user_nicename );
     486                $this->assertEquals( false, $user6 );
     487
     488                $user7 = WP_User::get_data_by( 'id', 99999 );
     489                $this->assertEquals( false, $user7 );
    486490        }
    487491
    … …  
    490494         */
    491495        public function test_user_get_data_by_ID_should_alias_to_id() {
    492                 $u = $this->factory->user->create();
    493 
    494                 $user = WP_User::get_data_by( 'ID', $u );
    495                 $this->assertEquals( $u, $user->ID );
     496                $user = WP_User::get_data_by( 'ID', self::$author_id );
     497                $this->assertEquals( self::$author_id, $user->ID );
    496498        }
    497499
    … …  
    500502         */
    501503        function test_count_many_users_posts() {
    502                 $user_id_a = $this->factory->user->create( array( 'role' => 'author' ) );
    503                 $user_id_b = $this->factory->user->create( array( 'role' => 'author' ) );
     504                $user_id_a = self::$static_factory->user->create( array( 'role' => 'author' ) );
     505                $user_id_b = self::$static_factory->user->create( array( 'role' => 'author' ) );
    504506                $post_id_a = $this->factory->post->create( array( 'post_author' => $user_id_a ) );
    505507                $post_id_b = $this->factory->post->create( array( 'post_author' => $user_id_b ) );
    … …  
    572574                        'user_login' => rand_str(),
    573575                        'user_pass'  => 'password',
    574                         'user_email' => 'blackburn@battlefield3.com',
    575                 ) );
    576                 $this->assertEquals( $id1, email_exists( 'blackburn@battlefield3.com' ) );
     576                        'user_email' => 'blackburn@battlefield4.com',
     577                ) );
     578                $this->assertEquals( $id1, email_exists( 'blackburn@battlefield4.com' ) );
    577579
    578580                $id2 = wp_insert_user( array(
    579581                        'user_login' => rand_str(),
    580582                        'user_pass'  => 'password',
    581                         'user_email' => 'miller@battlefield3.com',
    582                 ) );
    583                 $this->assertEquals( $id2, email_exists( 'miller@battlefield3.com' ) );
    584 
    585                 if( ! is_wp_error( $id2 ) ){
     583                        'user_email' => 'miller@battlefield4.com',
     584                ) );
     585                $this->assertEquals( $id2, email_exists( 'miller@battlefield4.com' ) );
     586
     587                if ( ! is_wp_error( $id2 ) ){
     588                        wp_update_user( array(
     589                                'ID'         => $id2,
     590                                'user_email' => 'david@battlefield4.com',
     591                        ) );
     592                        $this->assertEquals( $id2, email_exists( 'david@battlefield4.com' ) );
     593
    586594                        $return = wp_update_user( array(
    587595                                'ID'         => $id2,
    588                                 'user_email' => 'david@battlefield3.com',
     596                                'user_email' => 'blackburn@battlefield4.com',
    589597                        ) );
    590                         $this->assertEquals( $id2, email_exists( 'david@battlefield3.com' ) );
    591 
    592                         $return = wp_update_user( array(
    593                                 'ID'         => $id2,
    594                                 'user_email' => 'blackburn@battlefield3.com',
    595                         ) );
     598                       
    596599                        if ( ! defined( 'WP_IMPORTING' ) ) {
    597600                                $this->assertWPError( $return );
    … …  
    637640         */
    638641        public function test_wp_insert_user_should_sanitize_user_nicename_parameter() {
    639                 $user = $this->factory->user->create_and_get();
     642                $user = $this->author;
    640643
    641644                $userdata = $user->to_array();
    … …  
    720723         */
    721724        public function test_wp_insert_user_should_not_truncate_to_a_duplicate_user_nicename() {
    722                 $u1 = $this->factory->user->create( array(
     725                $u1 = self::$static_factory->user->create( array(
    723726                        'user_nicename' => str_repeat( 'a', 50 ),
    724727                ) );
    … …  
    741744         */
    742745        public function test_wp_insert_user_should_not_truncate_to_a_duplicate_user_nicename_when_suffix_has_more_than_one_character() {
    743                 $users = $this->factory->user->create_many( 9, array(
     746                $users = self::$static_factory->user->create_many( 4, array(
    744747                        'user_nicename' => str_repeat( 'a', 50 ),
    745748                ) );
    … …  
    754757                $this->assertNotEmpty( $u );
    755758                $user = new WP_User( $u );
    756                 $expected = str_repeat( 'a', 47 ) . '-10';
     759                $expected = str_repeat( 'a', 48 ) . '-5';
    757760                $this->assertSame( $expected, $user->user_nicename );
    758761        }
    … …  
    761764                global $wpdb;
    762765
    763                 $user = $this->factory->user->create_and_get();
     766                $user = $this->author;
    764767                $wpdb->update( $wpdb->users, array( 'user_activation_key' => 'key' ), array( 'ID' => $user->ID ) );
    765768                clean_user_cache( $user );
    … …  
    791794
    792795        public function test_search_users_login() {
    793                 $id = $this->factory->user->create( $this->user_data );
    794 
    795796                $users = get_users( array( 'search' => 'user1', 'fields' => 'ID' ) );
    796797
    797                 $this->assertTrue( in_array( $id, $users ) );
     798                $this->assertTrue( in_array( self::$test_id, $users ) );
    798799        }
    799800
    800801        public function test_search_users_url() {
    801                 $id = $this->factory->user->create( $this->user_data );
    802 
    803802                $users = get_users( array( 'search' => '*tacos*', 'fields' => 'ID' ) );
    804803
    805                 $this->assertTrue( in_array( $id, $users ) );
     804                $this->assertTrue( in_array( self::$test_id, $users ) );
    806805        }
    807806
    808807        public function test_search_users_email() {
    809                 $id = $this->factory->user->create( $this->user_data );
    810 
    811808                $users = get_users( array( 'search' => '*battle*', 'fields' => 'ID' ) );
    812809
    813                 $this->assertTrue( in_array( $id, $users ) );
     810                $this->assertTrue( in_array( self::$test_id, $users ) );
    814811        }
    815812
    816813        public function test_search_users_nicename() {
    817                 $id = $this->factory->user->create( $this->user_data );
    818 
    819814                $users = get_users( array( 'search' => '*one*', 'fields' => 'ID' ) );
    820815
    821                 $this->assertTrue( in_array( $id, $users ) );
     816                $this->assertTrue( in_array( self::$test_id, $users ) );
    822817        }
    823818
    824819        public function test_search_users_display_name() {
    825                 $id = $this->factory->user->create( $this->user_data );
    826 
    827820                $users = get_users( array( 'search' => '*Doe*', 'fields' => 'ID' ) );
    828821
    829                 $this->assertTrue( in_array( $id, $users ) );
     822                $this->assertTrue( in_array( self::$test_id, $users ) );
    830823        }
    831824
    … …  
    835828        function test_email_case() {
    836829                // Create a test user with a lower-case email address.
    837                 $user_id = $this->factory->user->create( array(
     830                $user_id = self::$static_factory->user->create( array(
    838831                        'user_email' => 'test@test.com',
    839832                ) );
    … …  
    854847        function test_email_change() {
    855848                // Create a test user.
    856                 $user_id = $this->factory->user->create( array(
     849                $user_id = self::$static_factory->user->create( array(
    857850                        'user_email' => 'test@test.com',
    858851                ) );
    … …  
    885878                $was_user_email_sent = false;
    886879
    887                 $user = $this->factory->user->create( $this->user_data );
    888 
    889                 wp_new_user_notification( $user, null, $notify );
     880                wp_new_user_notification( self::$test_id, null, $notify );
    890881
    891882                /*
    … …  
    944935         */
    945936        function test_wp_new_user_notification_old_signature_throws_deprecated_warning() {
    946                 $user = $this->factory->user->create(
    947                         array(
    948                                 'role'       => 'author',
    949                                 'user_login' => 'test_wp_new_user_notification',
    950                                 'user_pass'  => 'password',
    951                                 'user_email' => 'test@test.com',
    952                         )
    953                 );
     937                $user = self::$static_factory->user->create( array(
     938                        'role'       => 'author',
     939                        'user_login' => 'test_wp_new_user_notification',
     940                        'user_pass'  => 'password',
     941                        'user_email' => 'test@test.com',
     942                ) );
    954943
    955944                wp_new_user_notification( $user, 'this_is_deprecated' );
    … …  
    964953                $pwd_before = $user->user_pass;
    965954                wp_update_user( $user );
    966                
     955
    967956                // Reload the data
    968957                $pwd_after = get_userdata( $testuserid )->user_pass;
Note: See TracChangeset for help on using the changeset viewer.