Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertAddBeforeForPrice.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Mtf\Constraint\AbstractConstraint;
10 use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex;
11 use Magento\Mtf\Fixture\FixtureInterface;
12 
16 class AssertAddBeforeForPrice extends AbstractConstraint
17 {
26  public function processAssert(
27  FixtureInterface $product,
28  CatalogProductIndex $productGrid,
29  string $priceTypeSymbol,
30  \Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew $catalogProductNew
31  ) {
32  $filter = ['sku' => $product->getSku()];
33  $productGrid->open();
34  $productGrid->getProductGrid()->searchAndOpen($filter);
35 
36  $catalogProductNew->getProductForm()->openSection('customer-options');
37 
39  $options = $catalogProductNew->getProductForm()->getSection('customer-options');
40  $customOptions = $product->getCustomOptions()['import']['options'];
41 
42  foreach ($customOptions as $customOption) {
44  $valuesFromForm = $options->getValuesDataForOption(
45  $customOption['options'],
46  $customOption['type'],
47  $customOption['title']
48  );
49 
50  foreach ($valuesFromForm as $value) {
51  \PHPUnit\Framework\Assert::assertEquals($priceTypeSymbol, $value['add_before']);
52  }
53  }
54  }
55 
59  public function toString()
60  {
61  return 'Price for custom options has correct addbefore.';
62  }
63 }
$customOption
Definition: products.php:73
$value
Definition: gender.phtml:16