Fix tests.
This commit is contained in:
parent
2752356c4d
commit
9c469a9f60
|
@ -23,12 +23,14 @@ if ( 'core' !== $phase ) {
|
|||
$write = "<?php\n";
|
||||
$write .= "// WARNING: Do not directly edit this file.\n";
|
||||
$write .= "// This file is auto-generated as part of the build process and things may break.\n";
|
||||
$write .= "function wc_admin_get_feature_config() {\n";
|
||||
$write .= "\treturn array(\n";
|
||||
$write .= "if ( ! function_exists( 'wc_admin_get_feature_config' ) ) {\n";
|
||||
$write .= "\tfunction wc_admin_get_feature_config() {\n";
|
||||
$write .= "\t\treturn array(\n";
|
||||
foreach ( $config->features as $feature => $bool ) {
|
||||
$write .= "\t\t'{$feature}' => " . ( $bool ? 'true' : 'false' ) . ",\n";
|
||||
$write .= "\t\t\t'{$feature}' => " . ( $bool ? 'true' : 'false' ) . ",\n";
|
||||
}
|
||||
$write .= "\t);\n";
|
||||
$write .= "\t\t);\n";
|
||||
$write .= "\t}\n";
|
||||
$write .= "}\n";
|
||||
|
||||
$config_file = fopen( 'includes/feature-config.php', 'w' );
|
||||
|
|
|
@ -94,6 +94,14 @@ class WC_Tests_API_Reports_Stock_Stats extends WC_REST_Unit_Test_Case {
|
|||
$backorder_stock->set_stock_status( 'onbackorder' );
|
||||
$backorder_stock->save();
|
||||
|
||||
// Clear caches
|
||||
delete_transient( 'wc_admin_stock_count_lowstock' );
|
||||
delete_transient( 'wc_admin_stock_count_outofstock' );
|
||||
delete_transient( 'wc_admin_stock_count_onbackorder' );
|
||||
delete_transient( 'wc_admin_stock_count_lowstock' );
|
||||
delete_transient( 'wc_admin_stock_count_instock' );
|
||||
delete_transient( 'wc_admin_product_count' );
|
||||
|
||||
$request = new WP_REST_Request( 'GET', $this->endpoint );
|
||||
$response = $this->server->dispatch( $request );
|
||||
$reports = $response->get_data();
|
||||
|
|
Loading…
Reference in New Issue