@@ -636,18 +636,63 @@ public function testRowValidationForNumericalSkus()
636636 ]
637637 );
638638
639+ $ rowValidationDataProvider = $ this ->rowValidationDataProvider ();
640+
639641 // Checking that variations with duplicate sku are invalid
640- $ duplicateProduct = $ this ->_getNumericalSkuDataDuplicate ();
641- $ result = $ this ->configurable ->isRowValid ($ duplicateProduct , 0 );
642+ $ result = $ this ->configurable ->isRowValid ($ rowValidationDataProvider ['duplicateProduct ' ], 0 );
642643 $ this ->assertFalse ($ result );
643644
644645 // Checking that variations with SKUs that are the same when interpreted as number,
645646 // but different when interpreted as string are valid
646- $ nonDuplicateProduct = $ this ->_getNumericalSkuDataNonDuplicate ();
647- $ result = $ this ->configurable ->isRowValid ($ nonDuplicateProduct , 0 );
647+ $ result = $ this ->configurable ->isRowValid ($ rowValidationDataProvider ['nonDuplicateProduct ' ], 0 );
648648 $ this ->assertTrue ($ result );
649649 }
650650
651+ /**
652+ * @return array
653+ */
654+ public function rowValidationDataProvider ()
655+ {
656+ return [
657+ 'duplicateProduct ' => [
658+ 'sku ' => 'configurableNumericalSkuDuplicateVariation ' ,
659+ 'store_view_code ' => null ,
660+ 'attribute_set_code ' => 'Default ' ,
661+ 'product_type ' => 'configurable ' ,
662+ 'name ' => 'Configurable Product with duplicate numerical SKUs in variations ' ,
663+ 'product_websites ' => 'website_1 ' ,
664+ 'configurable_variation_labels ' => 'testattr2=Select Configuration ' ,
665+ 'configurable_variations ' => 'sku=1234.1, '
666+ . 'testattr2=attr2val1, '
667+ . 'display=1|sku=1234.1, '
668+ . 'testattr2=attr2val1, '
669+ . 'display=0 ' ,
670+ '_store ' => null ,
671+ '_attribute_set ' => 'Default ' ,
672+ '_type ' => 'configurable ' ,
673+ '_product_websites ' => 'website_1 ' ,
674+ ],
675+ 'nonDuplicateProduct ' => [
676+ 'sku ' => 'configurableNumericalSkuNonDuplicateVariation ' ,
677+ 'store_view_code ' => null ,
678+ 'attribute_set_code ' => 'Default ' ,
679+ 'product_type ' => 'configurable ' ,
680+ 'name ' => 'Configurable Product with different numerical SKUs in variations ' ,
681+ 'product_websites ' => 'website_1 ' ,
682+ 'configurable_variation_labels ' => 'testattr2=Select Configuration ' ,
683+ 'configurable_variations ' => 'sku=1234.10, '
684+ . 'testattr2=attr2val1, '
685+ . 'display=1|sku=1234.1, '
686+ . 'testattr2=attr2val2, '
687+ . 'display=0 ' ,
688+ '_store ' => null ,
689+ '_attribute_set ' => 'Default ' ,
690+ '_type ' => 'configurable ' ,
691+ '_product_websites ' => 'website_1 ' ,
692+ ]
693+ ];
694+ }
695+
651696 /**
652697 * Set object property value.
653698 *
@@ -664,54 +709,4 @@ protected function setPropertyValue(&$object, $property, $value)
664709
665710 return $ object ;
666711 }
667-
668- /**
669- * @return array
670- */
671- protected function _getNumericalSkuDataNonDuplicate (): array
672- {
673- return [
674- 'sku ' => 'configurableNumericalSkuNonDuplicateVariation ' ,
675- 'store_view_code ' => null ,
676- 'attribute_set_code ' => 'Default ' ,
677- 'product_type ' => 'configurable ' ,
678- 'name ' => 'Configurable Product with different numerical SKUs in variations ' ,
679- 'product_websites ' => 'website_1 ' ,
680- 'configurable_variation_labels ' => 'testattr2=Select Configuration ' ,
681- 'configurable_variations ' => 'sku=1234.10, '
682- . 'testattr2=attr2val1, '
683- . 'display=1|sku=1234.1, '
684- . 'testattr2=attr2val2, '
685- . 'display=0 ' ,
686- '_store ' => null ,
687- '_attribute_set ' => 'Default ' ,
688- '_type ' => 'configurable ' ,
689- '_product_websites ' => 'website_1 ' ,
690- ];
691- }
692-
693- /**
694- * @return array
695- */
696- protected function _getNumericalSkuDataDuplicate (): array
697- {
698- return [
699- 'sku ' => 'configurableNumericalSkuDuplicateVariation ' ,
700- 'store_view_code ' => null ,
701- 'attribute_set_code ' => 'Default ' ,
702- 'product_type ' => 'configurable ' ,
703- 'name ' => 'Configurable Product with duplicate numerical SKUs in variations ' ,
704- 'product_websites ' => 'website_1 ' ,
705- 'configurable_variation_labels ' => 'testattr2=Select Configuration ' ,
706- 'configurable_variations ' => 'sku=1234.1, '
707- . 'testattr2=attr2val1, '
708- . 'display=1|sku=1234.1, '
709- . 'testattr2=attr2val1, '
710- . 'display=0 ' ,
711- '_store ' => null ,
712- '_attribute_set ' => 'Default ' ,
713- '_type ' => 'configurable ' ,
714- '_product_websites ' => 'website_1 ' ,
715- ];
716- }
717712}
0 commit comments