Skip to content

Commit 07ca778

Browse files
Fix phpunit tsts.
1 parent cccef99 commit 07ca778

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

tests/phpunit/integration/Core/Email_Reporting/Email_Report_Section_BuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function test_build_sections_with_report_payloads() {
6969
'post_status' => Email_Log::STATUS_SENT,
7070
)
7171
);
72-
update_post_meta( $email_log_id, Email_Log::META_REPORT_REFERENCE_DATES, wp_json_encode( $date_range_meta ) );
72+
update_post_meta( $email_log_id, Email_Log::META_REPORT_REFERENCE_DATES, $date_range_meta );
7373
$email_log = get_post( $email_log_id );
7474

7575
// Example payload for the visitors section.

tests/phpunit/integration/Core/Email_Reporting/Initiator_TaskTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ function ( $timestamp ) use ( &$captured_fallback_timestamp, $scheduled_timestam
149149
$this->assertSame( 0, (int) $send_attempts, 'Email log send attempts should start at zero.' );
150150

151151
$reference_dates = get_post_meta( $post->ID, Email_Log::META_REPORT_REFERENCE_DATES, true );
152+
if ( is_string( $reference_dates ) ) {
153+
$reference_dates = json_decode( $reference_dates, true );
154+
}
155+
152156
$this->assertIsArray( $reference_dates, 'Reference dates should decode to an array.' );
153157
$this->assertArrayHasKey( 'startDate', $reference_dates, 'Reference dates should include start date.' );
154158
$this->assertArrayHasKey( 'endDate', $reference_dates, 'Reference dates should include end date.' );

tests/phpunit/integration/Core/User/REST_Email_Reporting_ControllerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ public function test_get_routes() {
139139
}
140140

141141
public function test_set_settings_subscribe_schedules_subscription_confirmation_batch() {
142+
remove_all_filters( 'googlesitekit_rest_routes' );
143+
remove_all_filters( 'googlesitekit_apifetch_preload_paths' );
144+
142145
$this->controller->register();
143146
$this->register_rest_routes();
144147

0 commit comments

Comments
 (0)