Skip to content

Commit

Permalink
Merge pull request #2559 from woocommerce/dev/2556-fixed-sku
Browse files Browse the repository at this point in the history
Use a fixed SKU number when testing product adapter
  • Loading branch information
mikkamp authored Aug 23, 2024
2 parents 315fce2 + 4c9d6db commit ec86226
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion tests/Tools/HelperTrait/ProductTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,12 @@ protected function generate_mock_image_attachment( int $product_id, string $imag
* @return WCProductAdapter The adapted products with the rules applied.
*/
protected function generate_attribute_mapping_adapted_product( $rules, $categories = [] ) {
$product = WC_Helper_Product::create_simple_product( false );
$product = WC_Helper_Product::create_simple_product(
false,
[
'sku' => 'Mapped Product SKU',
]
);

$attributes = [
WC_Helper_Product::create_product_attribute_object( 'size', [ 's', 'xs' ] ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function test_maps_rules_product_fields_sku() {
$adapted_product = $this->generate_attribute_mapping_adapted_product( $rules );
$adapted_variation = $this->generate_attribute_mapping_adapted_product_variant( $rules );

$this->assertEquals( 'DUMMY SKU', $adapted_product->getGtin() );
$this->assertEquals( 'Mapped Product SKU', $adapted_product->getGtin() );
$this->assertEquals( 'DUMMY SKU VARIABLE HUGE BLUE ANY NUMBER', $adapted_variation->getGtin() );
}

Expand Down

0 comments on commit ec86226

Please sign in to comment.