Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/14/2014 02:01:18 PM (12 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/notifications/class-bp-notifications-notification.php

    r8958 r9139  
    99         */
    1010        public function test_get_null_component_name() {
    11                 $u = $this->create_user();
     11                $u = $this->factory->user->create();
    1212                $n1 = $this->factory->notification->create( array(
    1313                        'component_name' => 'groups',
     
    5353         */
    5454        public function test_get_total_count_null_component_name() {
    55                 $u = $this->create_user();
     55                $u = $this->factory->user->create();
    5656                $n1 = $this->factory->notification->create( array(
    5757                        'component_name' => 'groups',
     
    9595         */
    9696        public function test_get_total_count_with_component_name() {
    97                 $u = $this->create_user();
     97                $u = $this->factory->user->create();
    9898                $n1 = $this->factory->notification->create( array(
    9999                        'component_name' => 'groups',
     
    123123        public function test_order_by_date() {
    124124                $now = time();
    125                 $u = $this->create_user();
     125                $u = $this->factory->user->create();
    126126                $n1 = $this->factory->notification->create( array(
    127127                        'component_name' => 'friends',
     
    156156         */
    157157        public function test_is_new_true() {
    158                 $u = $this->create_user();
     158                $u = $this->factory->user->create();
    159159                $n1 = $this->factory->notification->create( array(
    160160                        'component_name' => 'friends',
     
    188188         */
    189189        public function test_is_new_false() {
    190                 $u = $this->create_user();
     190                $u = $this->factory->user->create();
    191191                $n1 = $this->factory->notification->create( array(
    192192                        'component_name' => 'friends',
     
    220220         */
    221221        public function test_is_new_both() {
    222                 $u = $this->create_user();
     222                $u = $this->factory->user->create();
    223223                $n1 = $this->factory->notification->create( array(
    224224                        'component_name' => 'friends',
     
    253253         */
    254254        public function test_get_with_search_terms() {
    255                 $u = $this->create_user();
     255                $u = $this->factory->user->create();
    256256                $n1 = $this->factory->notification->create( array(
    257257                        'component_name' => 'friends',
Note: See TracChangeset for help on using the changeset viewer.