Ejemplo n.º 1
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));
 }