Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/03/2017 07:44:10 PM (7 years ago)
Author:
boonebgorges
Message:

Use static factory method throughout PHPUnit tests.

See #7620.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/core/class-bp-core-user.php

    r9819 r11737  
    1010     */
    1111    public function test_get_users_with_exclude_querystring() {
    12         $u1 = $this->factory->user->create();
    13         $u2 = $this->factory->user->create();
    14         $u3 = $this->factory->user->create();
     12        $u1 = self::factory()->user->create();
     13        $u2 = self::factory()->user->create();
     14        $u3 = self::factory()->user->create();
    1515
    1616        $exclude_qs = $u1 . ',junkstring,' . $u3;
     
    2626     */
    2727    public function test_get_users_with_exclude_array() {
    28         $u1 = $this->factory->user->create();
    29         $u2 = $this->factory->user->create();
    30         $u3 = $this->factory->user->create();
     28        $u1 = self::factory()->user->create();
     29        $u2 = self::factory()->user->create();
     30        $u3 = self::factory()->user->create();
    3131
    3232        $exclude_array = array(
     
    4646     */
    4747    public function test_get_users_with_include_querystring() {
    48         $u1 = $this->factory->user->create( array(
     48        $u1 = self::factory()->user->create( array(
    4949            'last_activity' => gmdate( 'Y-m-d H:i:s' ),
    5050        ) );
    51         $u2 = $this->factory->user->create( array(
     51        $u2 = self::factory()->user->create( array(
    5252            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
    5353        ) );
    54         $u3 = $this->factory->user->create( array(
     54        $u3 = self::factory()->user->create( array(
    5555            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
    5656        ) );
     
    6868     */
    6969    public function test_get_users_with_include_array() {
    70         $u1 = $this->factory->user->create( array(
     70        $u1 = self::factory()->user->create( array(
    7171            'last_activity' => gmdate( 'Y-m-d H:i:s' ),
    7272        ) );
    73         $u2 = $this->factory->user->create( array(
     73        $u2 = self::factory()->user->create( array(
    7474            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 1000 ),
    7575        ) );
    76         $u3 = $this->factory->user->create( array(
     76        $u3 = self::factory()->user->create( array(
    7777            'last_activity' => gmdate( 'Y-m-d H:i:s', time() - 50 ),
    7878        ) );
     
    100100     */
    101101    public function test_type_alphabetical() {
    102         $u1 = $this->factory->user->create( array(
     102        $u1 = self::factory()->user->create( array(
    103103            'display_name' => 'foo',
    104104        ) );
    105         $u2 = $this->factory->user->create( array(
     105        $u2 = self::factory()->user->create( array(
    106106            'display_name' => 'bar',
    107107        ) );
     
    119119     */
    120120    public function test_get_users_by_letter() {
    121         $u1 = $this->factory->user->create( array(
     121        $u1 = self::factory()->user->create( array(
    122122            'display_name' => 'foo',
    123123        ) );
    124         $u2 = $this->factory->user->create( array(
     124        $u2 = self::factory()->user->create( array(
    125125            'display_name' => 'bar',
    126126        ) );
     
    136136     */
    137137    public function test_search_users() {
    138         $u1 = $this->factory->user->create( array(
     138        $u1 = self::factory()->user->create( array(
    139139            'display_name' => 'foo',
    140140        ) );
    141         $u2 = $this->factory->user->create( array(
     141        $u2 = self::factory()->user->create( array(
    142142            'display_name' => 'bar',
    143143        ) );
     
    150150
    151151    public function test_get_specific_users() {
    152         $u1 = $this->factory->user->create();
    153         $u2 = $this->factory->user->create();
    154         $u3 = $this->factory->user->create();
     152        $u1 = self::factory()->user->create();
     153        $u2 = self::factory()->user->create();
     154        $u3 = self::factory()->user->create();
    155155
    156156        $include_array = array(
     
    170170     */
    171171    public function test_get_last_activity() {
    172         $u = $this->factory->user->create();
     172        $u = self::factory()->user->create();
    173173        $time = bp_core_current_time();
    174174
     
    186186     */
    187187    public function test_get_last_activity_store_in_cache() {
    188         $u = $this->factory->user->create();
     188        $u = self::factory()->user->create();
    189189        $time = bp_core_current_time();
    190190
     
    204204     */
    205205    public function test_get_last_activity_store_in_cache_multiple_users() {
    206         $u1 = $this->factory->user->create();
    207         $u2 = $this->factory->user->create();
     206        $u1 = self::factory()->user->create();
     207        $u2 = self::factory()->user->create();
    208208        $time = bp_core_current_time();
    209209
     
    225225     */
    226226    public function test_get_last_activity_from_cache_single_user() {
    227         $u    = $this->factory->user->create();
     227        $u    = self::factory()->user->create();
    228228        $time = bp_core_current_time();
    229229
     
    248248     */
    249249    public function test_get_last_activity_in_cache_multiple_users() {
    250         $u1 = $this->factory->user->create();
    251         $u2 = $this->factory->user->create();
     250        $u1 = self::factory()->user->create();
     251        $u2 = self::factory()->user->create();
    252252        $time = bp_core_current_time();
    253253
     
    273273     */
    274274    public function test_update_last_activity() {
    275         $u = $this->factory->user->create();
     275        $u = self::factory()->user->create();
    276276        $time = bp_core_current_time();
    277277        $time2 = '1968-12-25 01:23:45';
     
    292292     */
    293293    public function test_delete_last_activity() {
    294         $u = $this->factory->user->create();
     294        $u = self::factory()->user->create();
    295295        $time = bp_core_current_time();
    296296
Note: See TracChangeset for help on using the changeset viewer.