Changeset 11846
- Timestamp:
- 05/13/2022 06:33:14 PM (2 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-profiles-wp-activity-notifier
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-profiles-wp-activity-notifier/tests/e2e.php
r11845 r11846 23 23 24 24 function main( string $case ) : void { 25 switch_to_blog( 11 ); // make.w.org/test-site 25 if ( defined( 'IS_WORDCAMP_NETWORK' ) && IS_WORDCAMP_NETWORK ) { 26 switch_to_blog( 1056 ); // testing.wordcamp.org/2019 27 } else { 28 switch_to_blog( 11 ); // make.w.org/test-site 29 } 30 26 31 require_once dirname( __DIR__ ) . '/wporg-profiles-wp-activity-notifier.php'; 27 32 … … 48 53 49 54 function test_post( WPOrg_WP_Activity_Notifier $notifier ) : void { 50 $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1802 ) ); // post 51 sleep( 1 ); // buddypress don't show activity that happens at the exact same time 52 $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1826 ) ); // handbook 53 sleep( 1 ); 54 $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1832 ) ); // course 55 if ( defined( 'IS_WORDCAMP_NETWORK' ) && IS_WORDCAMP_NETWORK ) { 56 $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1 ) ); // post 57 58 } else { 59 $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1802 ) ); // post 60 sleep( 1 ); // buddypress doesn't show activity that happens at the exact same time 61 $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1826 ) ); // handbook 62 sleep( 1 ); 63 $notifier->maybe_notify_new_published_post( 'publish', 'draft', get_post( 1832 ) ); // course 64 } 55 65 } 56 66 57 67 function test_comment( WPOrg_WP_Activity_Notifier $notifier ) : void { 58 $notifier->insert_comment( 224, get_comment( 224 ) ); 68 if ( defined( 'IS_WORDCAMP_NETWORK' ) && IS_WORDCAMP_NETWORK ) { 69 $comment_id = 1; 70 } else { 71 $comment_id = 224; 72 } 73 74 $notifier->insert_comment( $comment_id, get_comment( $comment_id ) ); 59 75 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-profiles-wp-activity-notifier/wporg-profiles-wp-activity-notifier.php
r11845 r11846 29 29 30 30 private function __construct() { 31 require_once WPMU_PLUGIN_DIR . '/pub/profile-helpers.php'; 31 $is_wordcamp = defined( 'IS_WORDCAMP_NETWORK' ) && IS_WORDCAMP_NETWORK; 32 $environment = $is_wordcamp ? get_wordcamp_environment() : wp_get_environment_type(); 33 34 /* 35 * Requests will always fail when in local environments, unless the dev is proxied. Proxied devs could test 36 * locally if they're careful (especially with user IDs), but it's better to test on w.org sandboxes with 37 * test accounts. That prevents real profiles from having test data accidentally added to them. 38 */ 39 if ( 'local' === $environment ) { 40 return; 41 } 42 43 if ( $is_wordcamp ) { 44 require_once WP_CONTENT_DIR . '/mu-plugins-private/wporg-mu-plugins/pub/profile-helpers.php'; 45 } else { 46 require_once WPMU_PLUGIN_DIR . '/pub/profile-helpers.php'; 47 } 32 48 33 49 add_action( 'init', array( $this, 'init' ) );
Note: See TracChangeset
for help on using the changeset viewer.