コード例 #1
0
ファイル: Curl.php プロジェクト: kidaa30/magento2-platformsh
 /**
  * Prepare billing address data.
  *
  * @param array $data
  * @return array
  */
 protected function prepareBillingAddress(array $data)
 {
     $result = $data;
     $result['firstname'] = $this->customer->getFirstname();
     $result['lastname'] = $this->customer->getLastname();
     return $result;
 }
コード例 #2
0
 /**
  * Asserts that customer name in Contact information block and Account info tab matches name in fixture.
  *
  * @param CustomerAccountIndex $customerAccountIndex
  * @param CustomerAccountEdit $customerAccountEdit
  * @param Customer $customer
  * @return void
  */
 public function processAssert(CustomerAccountIndex $customerAccountIndex, CustomerAccountEdit $customerAccountEdit, Customer $customer)
 {
     $customerName = $customer->getFirstname() . " " . $customer->getLastname();
     $customerAccountIndex->open();
     $infoBlock = $customerAccountIndex->getInfoBlock()->getContactInfoContent();
     $infoBlock = explode(PHP_EOL, $infoBlock);
     $nameInDashboard = $infoBlock[0];
     \PHPUnit_Framework_Assert::assertTrue($nameInDashboard == $customerName, 'Customer name in Contact info block is not matching the fixture.');
     $customerAccountIndex->getInfoBlock()->openEditContactInfo();
     $nameInEdit = $customerAccountEdit->getAccountInfoForm()->getFirstName() . " " . $customerAccountEdit->getAccountInfoForm()->getLastName();
     \PHPUnit_Framework_Assert::assertTrue($nameInEdit == $customerName, 'Customer name on Account info tab is not matching the fixture.');
 }
 /**
  * Assert customer info in Abandoned Carts report (Reports > Abandoned carts):
  * – name and email
  * – products and qty
  * – created and updated date
  *
  * @param AbandonedCarts $abandonedCarts
  * @param array $products
  * @param Customer $customer
  * @return void
  */
 public function processAssert(AbandonedCarts $abandonedCarts, $products, Customer $customer)
 {
     $abandonedCarts->open();
     $qty = 0;
     foreach ($products as $product) {
         $qty += $product->getCheckoutData()['qty'];
     }
     $filter = ['customer_name' => $customer->getFirstname() . " " . $customer->getLastname(), 'email' => $customer->getEmail(), 'items_count' => count($products), 'items_qty' => $qty, 'created_at' => date('m/j/Y'), 'updated_at' => date('m/j/Y')];
     $abandonedCarts->getGridBlock()->search($filter);
     $filter['created_at'] = date('M j, Y');
     $filter['updated_at'] = date('M j, Y');
     \PHPUnit_Framework_Assert::assertTrue($abandonedCarts->getGridBlock()->isRowVisible($filter, false, false), 'Expected customer info is absent in Abandoned Carts report grid.');
 }
 /**
  * Prepare filter
  *
  * @param Customer $customer
  * @param array $columns
  * @param array $report
  * @return array
  */
 public function prepareFilter(Customer $customer, array $columns, array $report)
 {
     $format = '';
     switch ($report['report_period']) {
         case 'Day':
             $format = 'M j, Y';
             break;
         case 'Month':
             $format = 'j/Y';
             break;
         case 'Year':
             $format = 'Y';
             break;
     }
     return ['date' => date($format), 'customer' => $customer->getFirstname() . ' ' . $customer->getLastname(), 'orders' => $columns['orders'], 'average' => number_format($columns['average'], 2), 'total' => number_format($columns['total'], 2)];
 }
 /**
  * Assert customer is subscribed to newsletter
  *
  * @param Customer $customer
  * @param SubscriberIndex $subscriberIndex
  * @return void
  */
 public function processAssert(Customer $customer, SubscriberIndex $subscriberIndex)
 {
     $filter = ['email' => $customer->getEmail(), 'firstname' => $customer->getFirstname(), 'lastname' => $customer->getLastname(), 'status' => 'Subscribed'];
     $subscriberIndex->open();
     \PHPUnit_Framework_Assert::assertTrue($subscriberIndex->getSubscriberGrid()->isRowVisible($filter), 'Customer with email \'' . $customer->getEmail() . '\' is absent in Newsletter Subscribers grid.');
 }
コード例 #6
0
ファイル: Grid.php プロジェクト: andrewhowdencom/m2onk8s
 /**
  * Open customer review report
  *
  * @param Customer $customer
  * @return void
  */
 public function openReview(Customer $customer)
 {
     $customerName = $customer->getFirstname() . ' ' . $customer->getLastname();
     $this->_rootElement->find(sprintf($this->searchRow, $customerName), Locator::SELECTOR_XPATH)->click();
 }
コード例 #7
0
 /**
  * Assert that edit page of customer account contains correct title.
  *
  * @param CustomerAccountIndex $pageCustomerIndex
  * @param Customer $customer
  * @return void
  */
 public function processAssert(CustomerAccountIndex $pageCustomerIndex, Customer $customer)
 {
     \PHPUnit_Framework_Assert::assertEquals($customer->getFirstname() . ' ' . $customer->getLastname(), $pageCustomerIndex->getTitleBlock()->getTitle(), 'Wrong page title is displayed.');
 }
コード例 #8
0
 /**
  * Assert product reviews qty column in Review Report by Customer grid
  *
  * @param CustomerReportReview $customerReportReview
  * @param Customer $customer
  * @param int $reviewsCount
  * @return void
  */
 public function processAssert(CustomerReportReview $customerReportReview, Customer $customer, $reviewsCount)
 {
     $customerName = $customer->getFirstname() . ' ' . $customer->getLastname();
     $customerReportReview->open();
     \PHPUnit_Framework_Assert::assertEquals($reviewsCount, $customerReportReview->getGridBlock()->getQtyReview($customerName), 'Wrong qty review in Customer Reviews Report grid.');
 }