Skip to content

Commit

Permalink
Fix E2E tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
nfmohit committed Mar 7, 2024
1 parent e342f24 commit 5ac4486
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
3 changes: 1 addition & 2 deletions includes/Modules/Analytics_4.php
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,7 @@ private function print_tracking_opt_out() {
* @return bool
*/
protected function is_tracking_disabled() {
// @TODO Revert this when we use the new GA4 SettingsEdit form once #7932 is merged and we save all settings to the Analytics-4 module.
$settings = ( new Analytics( $this->context ) )->get_settings()->get();
$settings = $this->get_settings()->get();

// This filter is documented in Tag_Manager::filter_analytics_allow_tracking_disabled.
if ( ! apply_filters( 'googlesitekit_allow_tracking_disabled', $settings['useSnippet'] ) ) {
Expand Down
4 changes: 0 additions & 4 deletions tests/phpunit/integration/Modules/Analytics_4Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -2890,10 +2890,6 @@ public function test_tracking_opt_out_snippet( $settings, $logged_in, $is_tracki
$analytics = new Analytics_4( new Context( GOOGLESITEKIT_PLUGIN_MAIN_FILE ) );
$analytics->get_settings()->set( $settings );

// TODO Remove this when #7932 and #8082 are merged which save and migrate the new GA4 settings.
// This saves the trackingDisabled setting to the Analytics module which is being used temporarily.
( new Analytics( new Context( GOOGLESITEKIT_PLUGIN_MAIN_FILE ) ) )->get_settings()->merge( array( 'trackingDisabled' => $settings['trackingDisabled'] ) );

remove_all_actions( 'template_redirect' );
$analytics->register();
do_action( 'template_redirect' );
Expand Down

0 comments on commit 5ac4486

Please sign in to comment.