10 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductEdit;
12 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
13 use Magento\Mtf\Fixture\FixtureInterface;
30 BundleProduct $originalProduct,
31 CatalogProductIndex $productGrid,
32 CatalogProductEdit $productPage
34 $filter = [
'sku' =>
$product->getSku()];
36 $productGrid->getProductGrid()->searchAndOpen($filter);
39 $originalProductData = $originalProduct->getData()[
'bundle_selections'][
'bundle_options'];
40 $formData = $productPage->getProductForm()->getData(
$product)[
'bundle_selections'];
44 \PHPUnit\Framework\Assert::assertEquals($productDataLength, $formDataLength);
47 $productAssociatedDataLength = count(
$option[
'assigned_products']);
48 $formAssociatedDataLength = count($formData[
$index][
'assigned_products']);
49 \PHPUnit\Framework\Assert::assertEquals($productAssociatedDataLength, $formAssociatedDataLength);
51 foreach (
$option[
'assigned_products'] as $productIndex => $associatedProduct) {
52 $associatedProduct[
'data'][
'getProductName'] =
53 $originalProductData[
$index+1][
'assigned_products'][$productIndex][
'search_data'][
'name'];
54 $associatedProduct = $associatedProduct[
'data'];
55 $errorAssociatedProducts = array_diff(
57 $formData[
$index][
'assigned_products'][$productIndex]
59 \PHPUnit\Framework\Assert::assertCount(0, $errorAssociatedProducts);
62 unset(
$option[
'assigned_products']);
63 unset($formData[
$index][
'assigned_products']);
65 \PHPUnit\Framework\Assert::assertCount(0, $errorFields);
76 return 'Bundle options were not deleted correctly. There is difference with expected options';
processAssert(BundleProduct $product, BundleProduct $originalProduct, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)