Re-enable purchase unit tests and falling back to simply not display any prices when data is not available (#38163)

* Re-enable Purchase unit tests

* Fallback to simply not display any prices rather than empty prices when data is not available.

* Add changelog
This commit is contained in:
Chi-Hsuan Huang 2023-05-10 10:30:59 +08:00 committed by GitHub
parent 71981b5318
commit 4ba276d3fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 6 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Fallback to simply not display any prices rather than empty prices and re-enable Purchase unit tests

View File

@ -128,9 +128,6 @@ class OnboardingProducts {
$product_data[ $key ]['description'] = $products[ $product_type['product'] ]->excerpt;
$product_data[ $key ]['more_url'] = $products[ $product_type['product'] ]->link;
$product_data[ $key ]['slug'] = strtolower( preg_replace( '~[^\pL\d]+~u', '-', $products[ $product_type['product'] ]->slug ) );
} elseif ( isset( $product_type['product'] ) ) {
/* translators: site currency symbol (used to show that the product costs money) */
$product_data[ $key ]['label'] .= sprintf( __( ' — %s', 'woocommerce' ), html_entity_decode( get_woocommerce_currency_symbol() ) );
}
}

View File

@ -82,7 +82,6 @@ class WC_Admin_Tests_OnboardingTasks_Task_Purchase extends WC_Unit_Test_Case {
* Test is_complete function of Purchase task.
*/
public function test_is_not_complete_if_remaining_paid_products() {
$this->markTestSkipped( 'Skipped temporarily due to change in endpoint behavior.' );
update_option( OnboardingProfile::DATA_OPTION, array( 'product_types' => array( 'memberships' ) ) );
$this->assertEquals( false, $this->task->is_complete() );
}
@ -161,7 +160,6 @@ class WC_Admin_Tests_OnboardingTasks_Task_Purchase extends WC_Unit_Test_Case {
* Test the task title if 2 paid items exist.
*/
public function test_get_title_if_multiple_paid_themes() {
$this->markTestSkipped( 'Skipped temporarily due to change in endpoint behavior.' );
update_option(
OnboardingProfile::DATA_OPTION,
array(
@ -176,7 +174,6 @@ class WC_Admin_Tests_OnboardingTasks_Task_Purchase extends WC_Unit_Test_Case {
* Test the task title if multiple additional paid items exist.
*/
public function test_get_title_if_multiple_paid_products() {
$this->markTestSkipped( 'Skipped temporarily due to change in endpoint behavior.' );
update_option(
OnboardingProfile::DATA_OPTION,
array(