Remove update store details note (#35322)
* Remove update store details note * Remove deprecated tests * Remove changelog entry * Remove obsolete note
This commit is contained in:
parent
5b1296fe45
commit
a6ed0a0e36
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: update
|
||||
|
||||
Remove update store details note
|
|
@ -830,6 +830,7 @@ class WC_Install {
|
|||
'wc-admin-historical-data',
|
||||
'wc-admin-review-shipping-settings',
|
||||
'wc-admin-home-screen-feedback',
|
||||
'wc-admin-update-store-details',
|
||||
'wc-admin-effortless-payments-by-mollie',
|
||||
'wc-admin-google-ads-and-marketing',
|
||||
'wc-admin-marketing-intro',
|
||||
|
|
|
@ -42,7 +42,6 @@ use \Automattic\WooCommerce\Internal\Admin\Notes\SellingOnlineCourses;
|
|||
use \Automattic\WooCommerce\Internal\Admin\Notes\TestCheckout;
|
||||
use \Automattic\WooCommerce\Internal\Admin\Notes\TrackingOptIn;
|
||||
use \Automattic\WooCommerce\Internal\Admin\Notes\UnsecuredReportFiles;
|
||||
use \Automattic\WooCommerce\Internal\Admin\Notes\UpdateStoreDetails;
|
||||
use \Automattic\WooCommerce\Internal\Admin\Notes\WelcomeToWooCommerceForStoreUsers;
|
||||
use \Automattic\WooCommerce\Internal\Admin\Notes\WooCommercePayments;
|
||||
use \Automattic\WooCommerce\Internal\Admin\Notes\WooCommerceSubscriptions;
|
||||
|
@ -99,7 +98,6 @@ class Events {
|
|||
RealTimeOrderAlerts::class,
|
||||
TestCheckout::class,
|
||||
TrackingOptIn::class,
|
||||
UpdateStoreDetails::class,
|
||||
WooCommercePayments::class,
|
||||
WooCommerceSubscriptions::class,
|
||||
);
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* UpdateStoreDetails class
|
||||
*/
|
||||
|
||||
namespace Automattic\WooCommerce\Internal\Admin\Notes;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
use \Automattic\WooCommerce\Admin\Notes\Note;
|
||||
use \Automattic\WooCommerce\Admin\Notes\NoteTraits;
|
||||
|
||||
/**
|
||||
* Adds a note when the profiler is completed.
|
||||
*/
|
||||
class UpdateStoreDetails {
|
||||
/**
|
||||
* Note traits.
|
||||
*/
|
||||
use NoteTraits;
|
||||
|
||||
/**
|
||||
* Name of the note for use in the database.
|
||||
*/
|
||||
const NOTE_NAME = 'wc-admin-update-store-details';
|
||||
|
||||
/**
|
||||
* Get the note.
|
||||
*
|
||||
* @return Note
|
||||
*/
|
||||
public static function get_note() {
|
||||
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() );
|
||||
|
||||
// Bail when profile was set up by client.
|
||||
if ( isset( $onboarding_profile['setup_client'] ) && $onboarding_profile['setup_client'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Bail when profile is not yet completed.
|
||||
if ( ! isset( $onboarding_profile['completed'] ) || ! $onboarding_profile['completed'] ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$note = new Note();
|
||||
$note->set_title( __( 'Edit your store details if you need to', 'woocommerce' ) );
|
||||
$note->set_content( __( 'Nice work completing your store profile! You can always go back and edit the details you just shared, as needed.', 'woocommerce' ) );
|
||||
$note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
|
||||
$note->set_name( self::NOTE_NAME );
|
||||
$note->set_content_data( (object) array() );
|
||||
$note->set_source( 'woocommerce-admin' );
|
||||
$note->add_action(
|
||||
'update-store-details',
|
||||
__( 'Update store details', 'woocommerce' ),
|
||||
wc_admin_url( '&path=/setup-wizard' )
|
||||
);
|
||||
|
||||
return $note;
|
||||
}
|
||||
}
|
|
@ -218,79 +218,6 @@ class WC_Admin_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
|
|||
$this->assertEquals( 4, count( $notes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getting notes when the user is in tasklist experiment returns notes of size `per_page` without any filters.
|
||||
*
|
||||
* @since 3.5.0
|
||||
*/
|
||||
public function test_getting_notes_when_user_is_in_tasklist_experiment_returns_unfiltered_notes() {
|
||||
// Given.
|
||||
wp_set_current_user( $this->user );
|
||||
WC_Helper_Admin_Notes::reset_notes_dbs();
|
||||
// Notes of the following two names are hidden when the user is not in the task list experiment.
|
||||
WC_Helper_Admin_Notes::add_note_for_test( 'wc-admin-complete-store-details' );
|
||||
WC_Helper_Admin_Notes::add_note_for_test( 'wc-admin-update-store-details' );
|
||||
// Other notes.
|
||||
WC_Helper_Admin_Notes::add_note_for_test( 'winter-sales' );
|
||||
WC_Helper_Admin_Notes::add_note_for_test( '2022-promo' );
|
||||
|
||||
$this->set_user_in_tasklist_experiment();
|
||||
|
||||
// When.
|
||||
$request = new WP_REST_Request( 'GET', $this->endpoint );
|
||||
$request->set_query_params(
|
||||
array(
|
||||
'page' => '1',
|
||||
'per_page' => '3',
|
||||
)
|
||||
);
|
||||
$response = $this->server->dispatch( $request );
|
||||
$notes = $response->get_data();
|
||||
|
||||
// Then.
|
||||
$this->assertEquals( 200, $response->get_status() );
|
||||
$this->assertEquals( 3, count( $notes ) );
|
||||
$this->assertEquals( $notes[0]['name'], 'wc-admin-complete-store-details' );
|
||||
$this->assertEquals( $notes[1]['name'], 'wc-admin-update-store-details' );
|
||||
$this->assertEquals( $notes[2]['name'], 'winter-sales' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getting notes when the user is not in tasklist experiment excludes two notes.
|
||||
* @since 3.5.0
|
||||
*/
|
||||
public function test_getting_notes_when_user_is_not_in_tasklist_experiment_excludes_two_notes() {
|
||||
$this->markTestSkipped( 'We are disabling the experiments for now.' );
|
||||
// Given.
|
||||
wp_set_current_user( $this->user );
|
||||
WC_Helper_Admin_Notes::reset_notes_dbs();
|
||||
// Notes of the following two names are hidden when the user is not in the task list experiment.
|
||||
WC_Helper_Admin_Notes::add_note_for_test( 'wc-admin-complete-store-details' );
|
||||
WC_Helper_Admin_Notes::add_note_for_test( 'wc-admin-update-store-details' );
|
||||
// Other notes.
|
||||
WC_Helper_Admin_Notes::add_note_for_test( 'summer-sales' );
|
||||
WC_Helper_Admin_Notes::add_note_for_test( '2022-promo' );
|
||||
|
||||
$this->set_user_out_of_tasklist_experiment();
|
||||
|
||||
// When.
|
||||
$request = new WP_REST_Request( 'GET', $this->endpoint );
|
||||
$request->set_query_params(
|
||||
array(
|
||||
'page' => '1',
|
||||
'per_page' => '3',
|
||||
)
|
||||
);
|
||||
$response = $this->server->dispatch( $request );
|
||||
$notes = $response->get_data();
|
||||
|
||||
// Then.
|
||||
$this->assertEquals( 200, $response->get_status() );
|
||||
$this->assertEquals( 2, count( $notes ) );
|
||||
$this->assertEquals( $notes[0]['name'], 'summer-sales' );
|
||||
$this->assertEquals( $notes[1]['name'], '2022-promo' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getting notes of a certain type.
|
||||
*
|
||||
|
@ -621,30 +548,4 @@ class WC_Admin_Tests_API_Admin_Notes extends WC_REST_Unit_Test_Case {
|
|||
$this->assertEquals( 200, $response->get_status() );
|
||||
$this->assertEquals( 2, count( $notes ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulates when the user is in tasklist experiment similar to `API/Notes` `is_tasklist_experiment_assigned_treatment` function.
|
||||
*/
|
||||
private function set_user_in_tasklist_experiment() {
|
||||
// When the user is participating in either `wc-admin-complete-store-details` or `wc-admin-update-store-details` AB tests,
|
||||
// the user is in tasklist experiment.
|
||||
update_option( 'woocommerce_allow_tracking', 'yes' );
|
||||
$date = new \DateTime();
|
||||
$date->setTimeZone( new \DateTimeZone( 'UTC' ) );
|
||||
|
||||
$experiment_name = sprintf(
|
||||
'woocommerce_tasklist_progression_headercard_%s_%s',
|
||||
$date->format( 'Y' ),
|
||||
$date->format( 'm' )
|
||||
);
|
||||
set_transient( 'abtest_variation_' . $experiment_name, 'treatment' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Simulates when the user is not in tasklist experiment similar to `API/Notes` `is_tasklist_experiment_assigned_treatment` function.
|
||||
*/
|
||||
private function set_user_out_of_tasklist_experiment() {
|
||||
// Any experiment is off when `woocommerce_allow_tracking` option is false.
|
||||
update_option( 'woocommerce_allow_tracking', false );
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue