Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertSalesPrintOrderProducts.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Sales\Test\Page\SalesGuestPrint;
10 use Magento\Mtf\Constraint\AbstractConstraint;
11 use Magento\Mtf\Fixture\InjectableFixture;
12 
16 class AssertSalesPrintOrderProducts extends AbstractConstraint
17 {
21  const ERROR_MESSAGE = "Product with name: '%s' was not found on sales guest print page.\n";
22 
30  public function processAssert(SalesGuestPrint $salesGuestPrint, array $products)
31  {
32  $errors = '';
33  foreach ($products as $product) {
34  if (!$salesGuestPrint->getViewBlock()->getItemBlock()->isItemVisible($product)) {
35  $errors .= sprintf(self::ERROR_MESSAGE, $product->getName());
36  }
37  }
38 
39  \PHPUnit\Framework\Assert::assertEmpty($errors, $errors);
40  }
41 
47  public function toString()
48  {
49  return "Products were printed correctly.";
50  }
51 }
processAssert(SalesGuestPrint $salesGuestPrint, array $products)
$errors
Definition: overview.phtml:9