9 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
10 use Magento\ImportExport\Test\Fixture\ImportData;
11 use Magento\Mtf\Constraint\AbstractConstraint;
23 private $mappingData = [
25 'tier_price' =>
'price',
26 'tier_price_qty' =>
'price_qty',
27 'tier_price_website' =>
'website',
28 'tier_price_customer_group' =>
'customer_group',
29 'tier_price_value_type' =>
'value_type' 37 private $catalogProductEdit;
54 CatalogProductEdit $catalogProductEdit,
57 $this->catalogProductEdit = $catalogProductEdit;
58 $this->
import = $import;
60 $resultArrays = $this->getPreparePrices();
62 \PHPUnit\Framework\Assert::assertEquals(
63 $resultArrays[
'pageData'],
64 $resultArrays[
'csvData'],
65 'Tier prices from page and csv are not match.' 74 private function getPreparePrices()
76 $products = $this->
import->getDataFieldConfig(
'import_file')[
'source']->getEntities();
79 $resultProductArray = [];
81 $this->catalogProductEdit->open([
'id' =>
$product->getId()]);
82 $advancedPricing = $this->catalogProductEdit->getProductForm()->openSection(
'advanced-pricing')
83 ->getSection(
'advanced-pricing');
84 $tierPrices = $advancedPricing->getTierPriceForm()->getFieldsData();
87 $resultProductArray[$productSku][] = $tierPrice;
93 if ($this->import->getBehavior() !==
'Delete') {
94 $resultCsvArray = $this->getResultCsv();
97 return [
'pageData' => $resultProductArray,
'csvData' => $resultCsvArray];
105 private function getResultCsv()
107 $csvData = $this->
import->getDataFieldConfig(
'import_file')[
'source']->getCsv();
110 foreach (array_shift($csvData) as $csvKey) {
111 $csvKeys[] = isset($this->mappingData[$csvKey]) ? $this->mappingData[$csvKey] : $csvKey;
115 foreach ($csvData as $csvRowData) {
116 $csvRowData = array_combine($csvKeys, $csvRowData);
117 $sku = $csvRowData[
'sku'];
118 unset($csvRowData[
'sku']);
119 $resultCsvData[$sku][] = $csvRowData;
121 return $resultCsvData;
131 return 'Imported advanced prices are correct.';
processAssert(CatalogProductEdit $catalogProductEdit, ImportData $import)