From 46e82b1faffb7cb9f45b68a8c93a73c2041b3c74 Mon Sep 17 00:00:00 2001 From: Simon Dowdles Date: Thu, 5 Sep 2024 22:06:37 +0200 Subject: [PATCH 1/2] Update references of events_check to events_sync and alter logic accordingly where needed. --- .../Conversion_Reporting_Provider.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Provider.php b/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Provider.php index 6042302c708..7de8818f127 100644 --- a/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Provider.php +++ b/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Provider.php @@ -45,11 +45,11 @@ class Conversion_Reporting_Provider { private Conversion_Reporting_Cron $cron; /** - * Conversion_Reporting_Events_Check instance. + * Conversion_Reporting_Events_Sync instance. * - * @var Conversion_Reporting_Events_Check + * @var Conversion_Reporting_Events_Sync */ - private Conversion_Reporting_Events_Sync $events_check; + private Conversion_Reporting_Events_Sync $events_sync; /** * Constructor. @@ -68,8 +68,8 @@ public function __construct( $this->user_options = $user_options; $this->analytics = $analytics; - $this->events_check = new Conversion_Reporting_Events_Sync( $settings, $this->analytics ); - $this->cron = new Conversion_Reporting_Cron( fn() => $this->cron_callback() ); + $this->events_sync = new Conversion_Reporting_Events_Sync( $settings, $this->analytics ); + $this->cron = new Conversion_Reporting_Cron( fn() => $this->cron_callback() ); } /** @@ -101,7 +101,7 @@ protected function cron_callback() { $owner_id = $this->analytics->get_owner_id(); $restore_user = $this->user_options->switch_user( $owner_id ); - $this->events_check->check_for_events(); + $this->events_sync->check_for_events(); $restore_user(); } From 1c0199f75cb5524a034690c8e6a34344c4596081 Mon Sep 17 00:00:00 2001 From: Evan Mattson Date: Thu, 5 Sep 2024 21:16:44 -0400 Subject: [PATCH 2/2] Rename check method for consistency. --- .../Conversion_Reporting/Conversion_Reporting_Events_Sync.php | 4 ++-- .../Conversion_Reporting/Conversion_Reporting_Provider.php | 2 +- .../Conversion_Reporting_Events_SyncTest.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Events_Sync.php b/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Events_Sync.php index edcbecbef30..ce23fc4919b 100644 --- a/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Events_Sync.php +++ b/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Events_Sync.php @@ -61,11 +61,11 @@ public function __construct( } /** - * Checks for available events and save them in settings. + * Syncs detected events into settings. * * @since 1.135.0 */ - public function check_for_events() { + public function sync_detected_events() { $report = $this->get_report(); $detected_events = array(); diff --git a/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Provider.php b/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Provider.php index 7de8818f127..8bfc3008f91 100644 --- a/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Provider.php +++ b/includes/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Provider.php @@ -101,7 +101,7 @@ protected function cron_callback() { $owner_id = $this->analytics->get_owner_id(); $restore_user = $this->user_options->switch_user( $owner_id ); - $this->events_sync->check_for_events(); + $this->events_sync->sync_detected_events(); $restore_user(); } diff --git a/tests/phpunit/integration/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Events_SyncTest.php b/tests/phpunit/integration/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Events_SyncTest.php index 5306259bc3b..895a5683797 100644 --- a/tests/phpunit/integration/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Events_SyncTest.php +++ b/tests/phpunit/integration/Modules/Analytics_4/Conversion_Reporting/Conversion_Reporting_Events_SyncTest.php @@ -58,11 +58,11 @@ public function set_up() { /** * @dataProvider report_dimensions */ - public function test_check_for_events( $detected_events, $report_rows ) { + public function test_sync_detected_events( $detected_events, $report_rows ) { $this->setup_fake_handler_and_analytics( $report_rows ); $event_check = $this->get_instance(); - $event_check->check_for_events(); + $event_check->sync_detected_events(); $this->assertEquals( $detected_events, $this->settings->get()['detectedEvents'] ); }