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/groups/class-bp-groups-group.php

    r9107 r9139  
    903903     */
    904904    public function test_get_group_extras_non_member() {
    905         $u = $this->create_user();
     905        $u = $this->factory->user->create();
    906906        $g = $this->factory->group->create();
    907907
     
    934934     */
    935935    public function test_get_group_extras_member() {
    936         $u = $this->create_user();
     936        $u = $this->factory->user->create();
    937937        $g = $this->factory->group->create();
    938938        $this->add_user_to_group( $u, $g );
     
    966966     */
    967967    public function test_get_group_extras_invited() {
    968         $u = $this->create_user();
     968        $u = $this->factory->user->create();
    969969        $g = $this->factory->group->create();
    970970
     
    10051005     */
    10061006    public function test_get_group_extras_pending() {
    1007         $u = $this->create_user();
     1007        $u = $this->factory->user->create();
    10081008        $g = $this->factory->group->create();
    10091009
     
    10441044     */
    10451045    public function test_get_group_extras_banned() {
    1046         $u = $this->create_user();
     1046        $u = $this->factory->user->create();
    10471047        $g = $this->factory->group->create();
    10481048
Note: See TracChangeset for help on using the changeset viewer.