Exemplo n.º 1
0
 public function testIsRowValid()
 {
     $bunch = $this->_getBunch();
     $badProduct = ['sku' => 'configurableskuI22BadPrice', 'store_view_code' => null, 'attribute_set_code' => 'Default', 'product_type' => 'configurable', 'name' => 'Configurable Product 21 BadPrice', 'product_websites' => 'website_1', 'configurable_variation_prices' => 'name=testattr2,' . 'value=attr2val1,' . 'price=aaa|name=testattr3,' . 'value=testattr3v1,' . 'price=17|name=testattr3,' . 'value=testattr3v2,' . 'price=19', 'configurable_variation_labels' => 'testattr2=Select Color, testattr3=Select Size', 'configurable_variations' => 'sku=testconf2-attr2val1-testattr3v1,' . 'testattr2=attr2val1_DOESNT_EXIST,' . 'testattr3=testattr3v1,' . 'display=1|sku=testconf2-attr2val1-testattr3v2,' . 'testattr2=attr2val1,' . 'testattr3=testattr3v2,' . 'display=0', '_store' => null, '_attribute_set' => 'Default', '_type' => 'configurable', '_product_websites' => 'website_1'];
     $bunch[] = $badProduct;
     foreach ($bunch as $rowData) {
         $this->configurable->isRowValid($rowData, 0, !isset($this->_oldSku[$rowData['sku']]));
     }
 }
 public function testIsRowValid()
 {
     $bunch = $this->_getBunch();
     $badProduct = ['sku' => 'configurableskuI22BadPrice', 'store_view_code' => null, 'attribute_set_code' => 'Default', 'product_type' => 'configurable', 'name' => 'Configurable Product 21 BadPrice', 'product_websites' => 'website_1', 'configurable_variation_labels' => 'testattr2=Select Color, testattr3=Select Size', 'configurable_variations' => 'sku=testconf2-attr2val1-testattr3v1,' . 'testattr2=attr2val1_DOESNT_EXIST,' . 'testattr3=testattr3v1,' . 'display=1|sku=testconf2-attr2val1-testattr3v2,' . 'testattr2=attr2val1,' . 'testattr3=testattr3v2,' . 'display=0', '_store' => null, '_attribute_set' => 'Default', '_type' => 'configurable', '_product_websites' => 'website_1'];
     $bunch[] = $badProduct;
     // Set _attributes to avoid error in Magento\CatalogImportExport\Model\Import\Product\Type\AbstractType.
     $this->setPropertyValue($this->configurable, '_attributes', [$badProduct[\Magento\CatalogImportExport\Model\Import\Product::COL_ATTR_SET] => []]);
     foreach ($bunch as $rowData) {
         $this->configurable->isRowValid($rowData, 0, !isset($this->_oldSku[$rowData['sku']]));
     }
 }