Fix code sniffer violations in stock functions and its tests

This commit is contained in:
Nestor Soriano 2021-04-20 09:42:07 +02:00
parent 840849ad83
commit 1008835488
No known key found for this signature in database
GPG Key ID: 08110F3518C12CAD
2 changed files with 7 additions and 7 deletions

View File

@ -403,7 +403,7 @@ function wc_get_low_stock_amount( WC_Product $product ) {
$low_stock_amount = $product->get_low_stock_amount();
if ( '' === $low_stock_amount && $product->is_type( 'variation' ) ) {
$product = wc_get_product( $product->get_parent_id() );
$product = wc_get_product( $product->get_parent_id() );
$low_stock_amount = $product->get_low_stock_amount();
}

View File

@ -228,8 +228,8 @@ class WC_Stock_Functions_Tests extends \WC_Unit_Test_Case {
$product = WC_Helper_Product::create_simple_product(
true,
array(
'manage_stock' => true,
'stock_quantity' => 10,
'manage_stock' => true,
'stock_quantity' => 10,
)
);
@ -254,7 +254,7 @@ class WC_Stock_Functions_Tests extends \WC_Unit_Test_Case {
// Set the variation low stock amount.
$variations = $variable_product->get_available_variations( 'objects' );
$var1 = $variations[0];
$var1 = $variations[0];
$var1->set_manage_stock( true );
$var1->set_low_stock_amount( $variation_low_stock_amount );
$var1->save();
@ -292,7 +292,7 @@ class WC_Stock_Functions_Tests extends \WC_Unit_Test_Case {
// Set the variation low stock amount.
$variations = $variable_product->get_available_variations( 'objects' );
$var1 = $variations[0];
$var1 = $variations[0];
$var1->set_manage_stock( true );
$var1->set_low_stock_amount( $variation_low_stock_amount );
$var1->save();
@ -319,7 +319,7 @@ class WC_Stock_Functions_Tests extends \WC_Unit_Test_Case {
// Don't set the variation low stock amount.
$variations = $variable_product->get_available_variations( 'objects' );
$var1 = $variations[0];
$var1 = $variations[0];
$this->assertEquals( $parent_low_stock_amount, wc_get_low_stock_amount( $var1 ) );
}
@ -340,7 +340,7 @@ class WC_Stock_Functions_Tests extends \WC_Unit_Test_Case {
// Don't set the variation low stock amount.
$variations = $variable_product->get_available_variations( 'objects' );
$var1 = $variations[0];
$var1 = $variations[0];
$var1->set_manage_stock( false );
$this->assertEquals( $site_wide_low_stock_amount, wc_get_low_stock_amount( $var1 ) );