public function call($uri, $method = 'get', $parameters = array(), $changeStack = true) { $browser = parent::call($uri, $method, $parameters, $changeStack); $crawler = new Crawler(); $crawler->add($browser->getResponse()->getContent()); return $crawler; }
protected function call($uri, $method = 'get', $params = array()) { // multi testguy implementation $_SERVER['session_id'] = $this->session_id; if (false === ($empty = $this->browser->checkCurrentExceptionIsEmpty())) { \PHPUnit_Framework_Assert::fail(sprintf('last request threw an uncaught exception "%s: %s"', get_class($this->browser->getCurrentException()), $this->browser->getCurrentException()->getMessage())); return; } $this->debug('Request (' . $method . '): ' . $uri . ' ' . json_encode($params)); $this->browser->call($uri, $method, $params); $this->debug('Response code: ' . $this->browser->getResponse()->getStatusCode()); $this->debug('Response message: ' . $this->browser->getResponse()->getStatusText()); if ($form = $this->getForm()) { foreach ($form->getErrorSchema() as $field => $desc) { $this->debug("Error in form {$field} field: '{$desc}'"); } } $this->followRedirect(); }
/** * Remembers last request data for debuging * Throws current exception */ public function call($uri, $method = 'get', $parameters = array(), $changeStack = true) { $this->cleanUp(); parent::call($uri, $method, $parameters, $changeStack); $this->_lastRequest = $this->getRequest()->getUri(); $this->_lastRequestParams = var_export($this->getRequest()->getParameterHolder()->getAll(), true); if ($e = $this->getCurrentException()) { // Throw exception if not forward404 if (!$e instanceof sfError404Exception) { $this->resetCurrentException(); throw $e; } } $content = $this->getResponse()->getContent(); if ($pos = strpos($content, sfPHPUnitObjectHelper::XSS_TOKEN)) { $start = $pos - 150 > 0 ? $pos - 150 : 0; throw new Exception("Found XSS tocken: \n\n" . substr($content, $start, 300)); } $this->notify('postCall'); }
/** * Calls a request. * * @param string $uri URI to be invoked * @param string $method HTTP method used * @param array $parameters Additional paramaters * @param bool $changeStack If set to false ActionStack is not changed * * @return sfTestBrowser The current sfTestBrowser instance */ public function call($uri, $method = 'get', $parameters = array(), $changeStack = true) { $uri = $this->fixUri($uri); $this->test()->comment(sprintf('%s %s', strtolower($method), $uri)); return parent::call($uri, $method, $parameters, $changeStack); }
public function call($uri, $method = 'get', $parameters = array(), $changeStack = true) { parent::call($uri, $method, $parameters, $changeStack); $this->newRequestReset(); return $this; }