Add admin_install_timestamp in WC_Tracker (#50076)

* Add admin_install_timestamp in WC_Tracker

* Lint

* Tweak tests

* Tweak tests

* Lint
This commit is contained in:
Miguel Pérez Pellicer 2024-07-29 18:12:55 +04:00 committed by GitHub
parent 191c8edd18
commit 61d9b63f67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: minor
Type: tweak
Add admin_install_timestamp in WC_Tracker

View File

@ -965,6 +965,7 @@ class WC_Tracker {
'hpos_transactions_enabled' => get_option( 'woocommerce_use_db_transactions_for_custom_orders_table_data_sync' ),
'hpos_transactions_level' => get_option( 'woocommerce_db_transactions_isolation_level_for_custom_orders_table_data_sync' ),
'show_marketplace_suggestions' => get_option( 'woocommerce_show_marketplace_suggestions' ),
'admin_install_timestamp' => get_option( 'woocommerce_admin_install_timestamp' ),
);
}

View File

@ -231,4 +231,16 @@ class WC_Tracker_Test extends \WC_Unit_Test_Case {
$this->assertEquals( '12345', $tracking_data['store_id'] );
delete_option( \WC_Install::STORE_ID_OPTION );
}
/**
* @testDox Test woocommerce_install_admin_timestamp is included in tracking data.
*/
public function test_get_tracking_data_admin_install_timestamp() {
$time = time();
update_option( 'woocommerce_admin_install_timestamp', $time );
$tracking_data = WC_Tracker::get_tracking_data();
$this->assertArrayHasKey( 'admin_install_timestamp', $tracking_data['settings'] );
$this->assertEquals( $tracking_data['settings']['admin_install_timestamp'], $time );
delete_option( 'woocommerce_admin_install_timestamp' );
}
}