10 use Magento\Catalog\Test\Page\Product\CatalogProductView;
11 use Magento\Mtf\Client\BrowserInterface;
28 CatalogProductView $catalogProductView,
30 BrowserInterface $browser
32 $browser->open($_ENV[
'app_frontend_url'] .
$product->getUrlKey() .
'.html');
39 $formOptions = $catalogProductView->getViewBlock()->getOptions(
$product)[
'bundle_options'];
41 foreach ($formOptions as $key => $formOption) {
42 $formOptions[$key] = $this->
sortDataByPath($formOption,
'options::title');
46 \PHPUnit\Framework\Assert::assertEmpty($error, $error);
57 $bundleSelections =
$product->getBundleSelections();
58 $bundleOptions = isset($bundleSelections[
'bundle_options']) ? $bundleSelections[
'bundle_options'] : [];
63 'title' => $bundleOption[
'title'],
64 'type' => $bundleOption[
'frontend_type'],
65 'is_require' => $bundleOption[
'required'],
69 foreach ($bundleOption[
'assigned_products'] as $productKey => $assignedProduct) {
70 if ($this->isInStock(
$product, $key++)) {
71 $price = isset($assignedProduct[
'data'][
'selection_price_value'])
72 ? $assignedProduct[
'data'][
'selection_price_value']
73 : $bundleSelections[
'products'][$optionKey][$productKey]->getPrice();
76 'title' => $assignedProduct[
'search_data'][
'name'],
77 'price' => number_format(
$price, 2),
95 private function isInStock(BundleProduct
$product, $key)
97 $assignedProducts =
$product->getBundleSelections()[
'products'][0];
98 $status = $assignedProducts[$key]->getData()[
'quantity_and_stock_status'][
'is_in_stock'];
113 return 'Bundle options data on product page equals to passed from fixture dataset.';
prepareBundleOptions(BundleProduct $product)
processAssert(CatalogProductView $catalogProductView, BundleProduct $product, BrowserInterface $browser)