8 use Magento\Mtf\Constraint\AbstractConstraint;
9 use Magento\Mtf\Fixture\InjectableFixture;
39 $regexps = $this->prepareRegexpsForCheck($exportedFields,
$product);
40 \PHPUnit\Framework\Assert::assertTrue(
41 $this->isProductDataExists($regexps),
42 'A product with name ' .
$product->getName() .
' was not found in exported file.' 54 return 'A product(s) with correct data was found in exported file.';
64 private function prepareRegexpsForCheck(
68 $regexpsForCheck = [];
73 if (strpos($field,
'tier_price') !==
false) {
74 $replace = ($field ==
'tier_price' || $field ==
'tier_price_qty') ?
'tier_' :
'tier_price_';
75 $regexp .= preg_replace(
78 '.*(' .
$product->getData()[
'tier_price'][
$i][str_replace($replace,
'', $field)] .
')' 81 $regexp .=
'.*(' .
$product->getData($field) .
').*';
86 $regexpsForCheck[] = $regexp;
89 return $regexpsForCheck;
98 private function isProductDataExists(array
$data)
100 foreach (
$data as $regexp) {
101 preg_match($regexp, $this->exportData->getContent(), $matches);
102 if (empty($matches)) {
processAssert(ExportInterface $export, array $products, array $exportedFields)