/** * Authorize customer on backend. * * @throws \Exception * @return void */ protected function _authorize() { $url = $_ENV['app_backend_url']; $data = ['login[username]' => $this->_configuration->getParameter('application/backendLogin'), 'login[password]' => $this->_configuration->getParameter('application/backendPassword')]; $this->_transport->write(CurlInterface::POST, $url, '1.0', [], $data); $response = $this->read(); if (!strpos($response, 'link-logout')) { throw new \Exception("Admin user cannot be logged in by curl handler!\n Post url: {$url}"); } }
/** * Open backend page and log in if needed. * * @param array $params * @return $this */ public function open(array $params = []) { $admin = ['username' => ['value' => $this->configuration->getParameter('application/backendLogin')], 'password' => ['value' => $this->configuration->getParameter('application/backendPassword')]]; $this->adminAuthLogin = ObjectManager::getInstance()->create('Mage\\Adminhtml\\Test\\Page\\AdminAuthLogin'); $this->dashboard = ObjectManager::getInstance()->create('Mage\\Adminhtml\\Test\\Page\\Adminhtml\\Dashboard'); if (!$this->dashboard->getAdminPanelHeader()->isVisible()) { $this->loginSuperAdmin($admin); } return parent::open($params); }