Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/14/2014 02:01:18 PM (10 years ago)
Author:
boonebgorges
Message:

In automated tests, move user creation to a proper factory method.

BP user creation requires that a couple of extra pieces of data be set up
(last activity, display name, etc). So we previously had a wrapper in
BP_UnitTestCase called create_user() that performed the extra setup.
However, the wrapper made it impossible to use create_user() statically,
because the user_login and user_email iterator was not persistent from call to
call. (The create_user() syntax is also a break with the rest of our unit
tests, which is not ideal.)

This changeset introduces BP_UnitTest_Factory_For_User, which reproduces the
customizations of create_user(), but in a proper factory method. All
instances of create_user() throughout the test suite have also been replaced.

See #6009.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/core/nav.php

    r8958 r9139  
    198198     */
    199199    public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_my_profile() {
    200         $u = $this->create_user();
     200        $u = $this->factory->user->create();
    201201        $old_current_user = get_current_user_id();
    202202        $this->set_current_user( $u );
     
    220220     */
    221221    public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_others_profile_default_component_accessible() {
    222         $u1 = $this->create_user();
    223         $u2 = $this->create_user();
     222        $u1 = $this->factory->user->create();
     223        $u2 = $this->factory->user->create();
    224224        $old_current_user = get_current_user_id();
    225225        $this->set_current_user( $u1 );
     
    255255     */
    256256    public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_others_profile_default_component_not_accessible() {
    257         $u1 = $this->create_user();
    258         $u2 = $this->create_user();
     257        $u1 = $this->factory->user->create();
     258        $u2 = $this->factory->user->create();
    259259        $old_current_user = get_current_user_id();
    260260        $this->set_current_user( $u1 );
     
    290290     */
    291291    public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_group() {
    292         $u = $this->create_user();
     292        $u = $this->factory->user->create();
    293293        $g = $this->factory->group->create();
    294294        $old_current_user = get_current_user_id();
     
    319319     */
    320320    public function test_maybe_hook_new_subnav_screen_function_user_has_access_false_user_logged_in_group_no_redirect_url_provided() {
    321         $u = $this->create_user();
     321        $u = $this->factory->user->create();
    322322        $g = $this->factory->group->create();
    323323        $old_current_user = get_current_user_id();
Note: See TracChangeset for help on using the changeset viewer.