Merge pull request #21207 from woocommerce/speedup-get-request-url-test
Reduce WC_Tests_Paypal_Gateway_Request::test_request_url() execution time
This commit is contained in:
commit
b80c6d86fc
|
@ -25,11 +25,12 @@ class WC_Helper_Product {
|
|||
* @since 2.3
|
||||
* @return WC_Product_Simple
|
||||
*/
|
||||
public static function create_simple_product() {
|
||||
public static function create_simple_product( $save = true ) {
|
||||
$product = new WC_Product_Simple();
|
||||
$product->set_props( array(
|
||||
'name' => 'Dummy Product',
|
||||
'regular_price' => 10,
|
||||
'price' => 10,
|
||||
'sku' => 'DUMMY SKU',
|
||||
'manage_stock' => false,
|
||||
'tax_status' => 'taxable',
|
||||
|
@ -38,9 +39,13 @@ class WC_Helper_Product {
|
|||
'stock_status' => 'instock',
|
||||
'weight' => '1.1',
|
||||
) );
|
||||
$product->save();
|
||||
|
||||
return wc_get_product( $product->get_id() );
|
||||
if ( $save ) {
|
||||
$product->save();
|
||||
return wc_get_product( $product->get_id() );
|
||||
} else {
|
||||
return $product;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ class WC_Tests_Paypal_Gateway_Request extends WC_Unit_Test_Case {
|
|||
protected function create_products( $product_count = 30 ) {
|
||||
$this->products = array();
|
||||
for ( $i = 0; $i < $product_count; $i++ ) {
|
||||
$product = WC_Helper_Product::create_simple_product();
|
||||
$product = WC_Helper_Product::create_simple_product( false );
|
||||
$product->set_name( 'Dummy Product ' . $i );
|
||||
$this->products[] = $product;
|
||||
|
||||
|
|
Loading…
Reference in New Issue