Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/04/2018 07:58:30 PM (7 years ago)
Author:
boonebgorges
Message:

Add data exporter for Notifications component.

See #7827.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/testcases/notifications/functions.php

    r11888 r12158  
    433433        $this->assertEquals( 2, $found[0]->total_count );
    434434    }
     435
     436    /**
     437     * @ticket BP7827
     438     */
     439    public function test_bp_notifications_personal_data_exporter() {
     440        $u = self::factory()->user->create();
     441
     442        // Create notifications
     443        $n1 = self::factory()->notification->create( array(
     444            'component_name'    => 'messages',
     445            'component_action'  => 'new_message',
     446            'item_id'           => 99,
     447            'user_id'           => $u,
     448        ) );
     449
     450        $n2 = self::factory()->notification->create( array(
     451            'component_name'    => 'activity',
     452            'component_action'  => 'new_at_mention',
     453            'item_id'           => 99,
     454            'user_id'           => $u,
     455        ) );
     456
     457        $test_user = new WP_User( $u );
     458
     459        $actual = bp_notifications_personal_data_exporter( $test_user->user_email, 1 );
     460
     461        $this->assertTrue( $actual['done'] );
     462
     463        // Number of exported notification items.
     464        $this->assertSame( 2, count( $actual['data'] ) );
     465    }
    435466}
Note: See TracChangeset for help on using the changeset viewer.