Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
AssertAbandonedCartCustomerInfoResult.php
Go to the documentation of this file.
1 <?php
8 
10 use Magento\Reports\Test\Page\Adminhtml\AbandonedCarts;
11 use Magento\Mtf\Constraint\AbstractConstraint;
12 
17 class AssertAbandonedCartCustomerInfoResult extends AbstractConstraint
18 {
30  public function processAssert(AbandonedCarts $abandonedCarts, $products, Customer $customer)
31  {
32  $abandonedCarts->open();
33  $qty = 0;
34  foreach ($products as $product) {
35  $qty += $product->getCheckoutData()['qty'];
36  }
37  $filter = [
38  'customer_name' => $customer->getFirstname() . " " . $customer->getLastname(),
39  'email' => $customer->getEmail(),
40  'items_count' => count($products),
41  'items_qty' => $qty,
42  'created_at' => date('m/j/Y'),
43  'updated_at' => date('m/j/Y'),
44  ];
45  $abandonedCarts->getGridBlock()->search($filter);
46  $filter['created_at'] = date('M j, Y');
47  $filter['updated_at'] = date('M j, Y');
48  \PHPUnit\Framework\Assert::assertTrue(
49  $abandonedCarts->getGridBlock()->isRowVisible($filter, false, false),
50  'Expected customer info is absent in Abandoned Carts report grid.'
51  );
52  }
53 
59  public function toString()
60  {
61  return 'Customer info in Abandoned Carts report grid is correct.';
62  }
63 }
$customer
Definition: customers.php:11
processAssert(AbandonedCarts $abandonedCarts, $products, Customer $customer)