Skip to content

Commit

Permalink
Merge pull request #7679 from google/enhance/#7598-fix-e2e-test
Browse files Browse the repository at this point in the history
  • Loading branch information
aaemnnosttv committed Oct 9, 2023
2 parents 1b1cbb5 + 530decc commit 5e1f7d2
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 91 deletions.
31 changes: 13 additions & 18 deletions includes/Modules/Analytics_4/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,21 @@ public function get_owned_keys() {
* @return array
*/
protected function get_default() {
$options = array(
'ownerID' => 0,
return array(
'ownerID' => 0,
// TODO: These can be uncommented when Analytics and Analytics 4 modules are officially separated.
/* 'accountID' => '', */ // phpcs:ignore Squiz.PHP.CommentedOutCode.Found
/* 'adsConversionID' => '', */ // phpcs:ignore Squiz.PHP.CommentedOutCode.Found
'propertyID' => '',
'webDataStreamID' => '',
'measurementID' => '',
'useSnippet' => true,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
/* 'accountID' => '', */ // phpcs:ignore Squiz.PHP.CommentedOutCode.Found
/* 'adsConversionID' => '', */ // phpcs:ignore Squiz.PHP.CommentedOutCode.Found
'propertyID' => '',
'webDataStreamID' => '',
'measurementID' => '',
'useSnippet' => true,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
'availableCustomDimensions' => null,
);

if ( Feature_Flags::enabled( 'newsKeyMetrics' ) ) {
$options['availableCustomDimensions'] = null;
}

return $options;
}

/**
Expand Down
23 changes: 0 additions & 23 deletions tests/phpunit/integration/Modules/Analytics_4/SettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,29 +63,6 @@ public function set_up() {
public function test_get_default() {
$this->settings->register();

$this->assertEqualSetsWithIndex(
array(
// TODO: These can be uncommented when Analytics and Analytics 4 modules are officially separated.
// 'accountID' => '',
// 'adsConversionID' => '',
'propertyID' => '',
'webDataStreamID' => '',
'measurementID' => '',
'useSnippet' => true,
'ownerID' => 0,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
),
get_option( Settings::OPTION )
);
}

public function test_get_default__news_key_metrics() {
$this->enable_feature( 'newsKeyMetrics' );
$this->settings->register();

$this->assertEqualSetsWithIndex(
array(
// TODO: These can be uncommented when Analytics and Analytics 4 modules are officially separated.
Expand Down
105 changes: 55 additions & 50 deletions tests/phpunit/integration/Modules/Analytics_4Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -291,16 +291,17 @@ function ( Request $request ) use ( $property_id, $webdatastream_id, $measuremen

$this->assertEqualSetsWithIndex(
array(
'accountID' => $account_id,
'propertyID' => '',
'webDataStreamID' => '',
'measurementID' => '',
'ownerID' => 0,
'useSnippet' => true,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
'accountID' => $account_id,
'propertyID' => '',
'webDataStreamID' => '',
'measurementID' => '',
'ownerID' => 0,
'useSnippet' => true,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
'availableCustomDimensions' => null,
),
$options->get( Settings::OPTION )
);
Expand All @@ -309,16 +310,17 @@ function ( Request $request ) use ( $property_id, $webdatastream_id, $measuremen

$this->assertEqualSetsWithIndex(
array(
'accountID' => $account_id,
'propertyID' => $property_id,
'webDataStreamID' => $webdatastream_id,
'measurementID' => $measurement_id,
'ownerID' => 0,
'useSnippet' => true,
'googleTagID' => 'GT-123',
'googleTagAccountID' => $google_tag_account_id,
'googleTagContainerID' => $google_tag_container_id,
'googleTagLastSyncedAtMs' => 0,
'accountID' => $account_id,
'propertyID' => $property_id,
'webDataStreamID' => $webdatastream_id,
'measurementID' => $measurement_id,
'ownerID' => 0,
'useSnippet' => true,
'googleTagID' => 'GT-123',
'googleTagAccountID' => $google_tag_account_id,
'googleTagContainerID' => $google_tag_container_id,
'googleTagLastSyncedAtMs' => 0,
'availableCustomDimensions' => null,
),
$options->get( Settings::OPTION )
);
Expand Down Expand Up @@ -424,16 +426,17 @@ function ( Request $request ) use ( $property_id, $webdatastream_id, $measuremen

$this->assertEqualSetsWithIndex(
array(
'accountID' => $account_id,
'propertyID' => '',
'webDataStreamID' => '',
'measurementID' => '',
'ownerID' => 0,
'useSnippet' => true,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
'accountID' => $account_id,
'propertyID' => '',
'webDataStreamID' => '',
'measurementID' => '',
'ownerID' => 0,
'useSnippet' => true,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
'availableCustomDimensions' => null,
),
$options->get( Settings::OPTION )
);
Expand Down Expand Up @@ -537,16 +540,17 @@ function ( Request $request ) use ( $property_id, $webdatastream_id, $measuremen

$this->assertEqualSetsWithIndex(
array(
'accountID' => $account_id,
'propertyID' => '',
'webDataStreamID' => '',
'measurementID' => '',
'ownerID' => 0,
'useSnippet' => true,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
'accountID' => $account_id,
'propertyID' => '',
'webDataStreamID' => '',
'measurementID' => '',
'ownerID' => 0,
'useSnippet' => true,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
'availableCustomDimensions' => null,
),
$options->get( Settings::OPTION )
);
Expand All @@ -557,16 +561,17 @@ function ( Request $request ) use ( $property_id, $webdatastream_id, $measuremen

$this->assertEqualSetsWithIndex(
array(
'accountID' => $account_id,
'propertyID' => $property_id,
'webDataStreamID' => $webdatastream_id,
'measurementID' => $measurement_id,
'ownerID' => 0,
'useSnippet' => true,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
'accountID' => $account_id,
'propertyID' => $property_id,
'webDataStreamID' => $webdatastream_id,
'measurementID' => $measurement_id,
'ownerID' => 0,
'useSnippet' => true,
'googleTagID' => '',
'googleTagAccountID' => '',
'googleTagContainerID' => '',
'googleTagLastSyncedAtMs' => 0,
'availableCustomDimensions' => null,
),
$options->get( Settings::OPTION )
);
Expand Down

0 comments on commit 5e1f7d2

Please sign in to comment.