/**
  * Assert customer availability in Customer Grid
  *
  * @param CustomerInjectable $customer
  * @param CustomerIndex $pageCustomerIndex
  * @param CustomerInjectable $initialCustomer [optional]
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function processAssert(CustomerInjectable $customer, CustomerIndex $pageCustomerIndex, CustomerInjectable $initialCustomer = null)
 {
     if ($initialCustomer) {
         $customer = $customer->hasData() ? array_merge($initialCustomer->getData(), $customer->getData()) : $initialCustomer->getData();
     } else {
         $customer = $customer->getData();
     }
     $name = (isset($customer['prefix']) ? $customer['prefix'] . ' ' : '') . $customer['firstname'] . (isset($customer['middlename']) ? ' ' . $customer['middlename'] : '') . ' ' . $customer['lastname'] . (isset($customer['suffix']) ? ' ' . $customer['suffix'] : '');
     $filter = ['name' => $name, 'email' => $customer['email']];
     $pageCustomerIndex->open();
     \PHPUnit_Framework_Assert::assertTrue($pageCustomerIndex->getCustomerGridBlock()->isRowVisible($filter), 'Customer with ' . 'name \'' . $filter['name'] . '\', ' . 'email \'' . $filter['email'] . '\' ' . 'is absent in Customer grid.');
 }
Beispiel #2
0
 /**
  * Assert that displayed customer data on edit page(backend) equals passed from fixture
  *
  * @param CustomerInjectable $customer
  * @param CustomerIndex $pageCustomerIndex
  * @param CustomerIndexEdit $pageCustomerIndexEdit
  * @param AddressInjectable $address [optional]
  * @param CustomerInjectable $initialCustomer [optional]
  * @return void
  */
 public function processAssert(CustomerInjectable $customer, CustomerIndex $pageCustomerIndex, CustomerIndexEdit $pageCustomerIndexEdit, AddressInjectable $address = null, CustomerInjectable $initialCustomer = null)
 {
     $data = [];
     $filter = [];
     if ($initialCustomer) {
         $data['customer'] = $customer->hasData() ? array_merge($initialCustomer->getData(), $customer->getData()) : $initialCustomer->getData();
     } else {
         $data['customer'] = $customer->getData();
     }
     if ($address) {
         $data['addresses'][1] = $address->hasData() ? $address->getData() : [];
     } else {
         $data['addresses'] = [];
     }
     $filter['email'] = $data['customer']['email'];
     $pageCustomerIndex->open();
     $pageCustomerIndex->getCustomerGridBlock()->searchAndOpen($filter);
     $dataForm = $pageCustomerIndexEdit->getCustomerForm()->getDataCustomer($customer, $address);
     $dataDiff = $this->verify($data, $dataForm);
     \PHPUnit_Framework_Assert::assertTrue(empty($dataDiff), 'Customer data on edit page(backend) not equals to passed from fixture.' . "\nFailed values: " . implode(', ', $dataDiff));
 }