Making WordPress.org


Ignore:
Timestamp:
08/12/2022 09:13:41 PM (4 years ago)
Author:
iandunn
Message:

Profiles: Notify of activity when handbooks are updated.

See https://github.com/WordPress/five-for-the-future/issues/193

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-profiles-wp-activity-notifier/tests/e2e.php

    r11892 r12017  
    99
    1010namespace WordPressdotorg\Activity_Notifier\Tests;
    11 use WPOrg_WP_Activity_Notifier;
     11use WPOrg_WP_Activity_Notifier, WP_User;
    1212
    1313ini_set( 'display_errors', 'On' ); // won't do anything if fatal errors
     
    5252}
    5353
    54 function test_post( WPOrg_WP_Activity_Notifier $notifier ) : void {
     54function test_new_post( WPOrg_WP_Activity_Notifier $notifier ) : void {
    5555    if ( defined( 'IS_WORDCAMP_NETWORK' ) && IS_WORDCAMP_NETWORK ) {
    5656        $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1 ) ); // post
     
    6969}
    7070
     71function test_update_handbook( WPOrg_WP_Activity_Notifier $notifier, WP_User $user ) : void {
     72    // WordCamp.org doesn't use the Handbook plugin.
     73    if ( defined( 'IS_WORDCAMP_NETWORK' ) && IS_WORDCAMP_NETWORK ) {
     74        return;
     75    }
     76
     77    wp_set_current_user( $user->ID );
     78
     79    // This should notify
     80    $handbook = get_post( 1849 );
     81    $notifier->maybe_notify_updated_post( $handbook->ID, $handbook, $handbook );
     82
     83    sleep( 1 ); // buddypress doesn't show activity that happens at the exact same time
     84
     85    // This should not notify
     86    $regular_post = get_post( 1879 ); // `post` post type.
     87    $notifier->maybe_notify_updated_post( $regular_post->ID, $regular_post, $regular_post );
     88}
     89
    7190function test_comment( WPOrg_WP_Activity_Notifier $notifier ) : void {
    7291    if ( defined( 'IS_WORDCAMP_NETWORK' ) && IS_WORDCAMP_NETWORK ) {
Note: See TracChangeset for help on using the changeset viewer.