@@ -776,6 +776,77 @@ public function testValidateAmbiguousData(
776
776
$ this ->assertEquals ($ errors , $ resultErrors );
777
777
}
778
778
779
+ /**
780
+ * Test for row without store view code field
781
+ * @param array $rowData
782
+ * @param array $responseData
783
+ *
784
+ * @covers \Magento\CatalogImportExport\Model\Import\Product\Option::_parseCustomOptions
785
+ * @dataProvider validateRowStoreViewCodeFieldDataProvider
786
+ */
787
+ public function testValidateRowDataForStoreViewCodeField ($ rowData , $ responseData )
788
+ {
789
+ $ reflection = new \ReflectionClass (\Magento \CatalogImportExport \Model \Import \Product \Option::class);
790
+ $ reflectionMethod = $ reflection ->getMethod ('_parseCustomOptions ' );
791
+ $ reflectionMethod ->setAccessible (true );
792
+ $ result = $ reflectionMethod ->invoke ($ this ->model , $ rowData );
793
+ $ this ->assertEquals ($ responseData , $ result );
794
+ }
795
+
796
+ /**
797
+ * Data provider for test of method _parseCustomOptions
798
+ *
799
+ * @return array
800
+ */
801
+ public function validateRowStoreViewCodeFieldDataProvider ()
802
+ {
803
+ return [
804
+ 'with_store_view_code ' => [
805
+ '$rowData ' => [
806
+ 'store_view_code ' => '' ,
807
+ 'custom_options ' =>
808
+ 'name=Test Field Title,type=field,required=1;sku=1-text,price=0,price_type=fixed '
809
+ ],
810
+ '$responseData ' => [
811
+ 'store_view_code ' => '' ,
812
+ 'custom_options ' => [
813
+ 'Test Field Title ' => [
814
+ [
815
+ 'name ' => 'Test Field Title ' ,
816
+ 'type ' => 'field ' ,
817
+ 'required ' => '1 ' ,
818
+ 'sku ' => '1-text ' ,
819
+ 'price ' => '0 ' ,
820
+ 'price_type ' => 'fixed ' ,
821
+ '_custom_option_store ' => ''
822
+ ]
823
+ ]
824
+ ]
825
+ ],
826
+ ],
827
+ 'without_store_view_code ' => [
828
+ '$rowData ' => [
829
+ 'custom_options ' =>
830
+ 'name=Test Field Title,type=field,required=1;sku=1-text,price=0,price_type=fixed '
831
+ ],
832
+ '$responseData ' => [
833
+ 'custom_options ' => [
834
+ 'Test Field Title ' => [
835
+ [
836
+ 'name ' => 'Test Field Title ' ,
837
+ 'type ' => 'field ' ,
838
+ 'required ' => '1 ' ,
839
+ 'sku ' => '1-text ' ,
840
+ 'price ' => '0 ' ,
841
+ 'price_type ' => 'fixed '
842
+ ]
843
+ ]
844
+ ]
845
+ ],
846
+ ]
847
+ ];
848
+ }
849
+
779
850
/**
780
851
* Data provider of row data and errors
781
852
*
0 commit comments