protected function ajaxTestRequest($url, array $post) { $hostURL = 'http://serien-loader.philipp.zpintern/'; $ajaxURL = $hostURL . ltrim($url, '/'); $request = new Request($ajaxURL); $request->setPost($post); $hostConfig = PSC::getProjectsFactory()->getHostConfig(); $request->setAuthentication($hostConfig->req('cms.user'), $hostConfig->req('cms.password'), CURLAUTH_BASIC); $json = json_decode($request->init()->process()); $this->assertInstanceof('stdClass', $json, 'Response kann nicht zu JSOn aufgelöst werden (pw richtig??)'); $this->assertEquals('ok', $json->status); return $json; }
/** * @return Psc\URL\Request */ protected function getRequest() { if (!isset($this->request)) { $this->request = new \Psc\URL\Request($this->expandUrl($this->url)); $this->request->setAuthentication($this->hostConfig->req('cmf.user'), $this->hostConfig->req('cmf.password'), CURLAUTH_BASIC); $this->request->setHeaderField('X-Psc-Cms-Connection', 'tests'); $this->request->setHeaderField('X-Psc-Cms-Debug-Level', 15); if ($this->method == 'GET' || $this->method == 'POST') { $this->request->setType($this->method); } else { $this->request->setType('POST'); $this->request->setHeaderField('X-Psc-Cms-Request-Method', $this->method); } $this->setContentType('html'); // this is great for debugging, but it slows down 50% if ($this->sendDebugSessionCookie && $this->hostConfig->get('uagent-key') != NULL) { $this->request->setHeaderField('Cookie', 'XDEBUG_SESSION=' . $this->hostConfig->get('uagent-key')); } } return $this->request; }
protected function passwordRequest($username, $password, $url) { $req = new Request($url); $req->setAuthentication($username, $password); return $req; }