Exemplo n.º 1
0
 /**
  * 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;
 }
 /**
  * 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.");
 }
 /**
  * Authorize customer on frontend.
  *
  * @param Customer $customer
  * @throws \Exception
  * @return void
  */
 protected function authorize(Customer $customer)
 {
     $url = $_ENV['app_frontend_url'] . 'customer/account/login/';
     $this->transport->write(CurlInterface::POST, $url);
     $this->read();
     $url = $_ENV['app_frontend_url'] . 'customer/account/loginPost/';
     $data = ['login[username]' => $customer->getEmail(), 'login[password]' => $customer->getPassword(), 'form_key' => $this->formKey];
     $this->transport->write(CurlInterface::POST, $url, '1.1', ['Set-Cookie:' . $this->cookies], $data);
     $response = $this->read();
     if (strpos($response, 'customer/account/login')) {
         throw new \Exception($customer->getFirstname() . ', cannot be logged in by curl handler!');
     }
 }