function testUrlAccessor() { $headers = new MockSimpleHttpHeaders(); $response = new MockSimpleHttpResponse(); $response->setReturnValue('getHeaders', $headers); $response->setReturnValue('getMethod', 'POST'); $response->setReturnValue('getUrl', new SimpleUrl('here')); $response->setReturnValue('getRequestData', array('a' => 'A')); $page = new SimplePage($response); $this->assertEqual($page->getMethod(), 'POST'); $this->assertEqual($page->getUrl(), new SimpleUrl('here')); $this->assertEqual($page->getRequestData(), array('a' => 'A')); }
/** * Equivalent to hitting the retry button on the * browser. Will attempt to repeat the page fetch. If * there is no history to repeat it will give false. * @return string/boolean Content if fetch succeeded * else false. * @access public */ function retry() { $frames = $this->page->getFrameFocus(); if (count($frames) > 0) { $this->loadFrame($frames, $this->page->getUrl(), $this->page->getRequestData()); return $this->page->getRaw(); } if ($url = $this->history->getUrl()) { $this->page = $this->fetch($url, $this->history->getParameters()); return $this->page->getRaw(); } return false; }