10 use Magento\Mtf\Util\Protocol\CurlInterface;
66 $url = $_ENV[
'app_frontend_url'] .
'customer/account/login/';
67 $this->transport->write(
$url, [], CurlInterface::GET);
69 $url = $_ENV[
'app_frontend_url'] .
'customer/account/loginPost/';
71 'login[username]' =>
$customer->getEmail(),
72 'login[password]' =>
$customer->getPassword(),
75 $this->transport->write(
$url,
$data, CurlInterface::POST, [
'Set-Cookie:' . $this->cookies]);
77 if (strpos(
$response,
'customer/account/login') !==
false) {
78 throw new \Exception(
$customer->getFirstname() .
', cannot be logged in by curl handler!');
89 $str = substr($this->response, strpos($this->response,
'form_key'));
90 preg_match(
'/value="(.*)" \/>/', $str, $matches);
91 if (!empty($matches[1])) {
92 $this->formKey = $matches[1];
103 preg_match_all(
'|Set-Cookie: (.*);|U', $this->response, $matches);
104 if (!empty($matches[1])) {
105 $this->cookies = implode(
'; ', $matches[1]);
120 if ($this->formKey) {
134 $this->response = $this->transport->read();
159 $this->transport->close();
__construct(CurlTransport $transport, Customer $customer)
write($url, $params=[], $method=CurlInterface::POST, $headers=[])
addOption($option, $value)
authorize(Customer $customer)
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]