return $this->requestMethod;
    }
}
$t = new lime_test($nb_test_orig * count($adapter_list), new lime_output_color());
foreach ($adapter_list as $adapter) {
    $t->diag('Testing ' . $adapter);
    $t->diag('');
    /******************/
    /* Initialization */
    /******************/
    $t->diag('Initialization');
    $b = new sfWebBrowser(array(), $adapter);
    $t->is($b->getUserAgent(), '', 'a new browser has an empty user agent');
    $t->is($b->getResponseText(), '', 'a new browser has an empty response');
    $t->is($b->getResponseCode(), '', 'a new browser has an empty response code');
    $t->is($b->getResponseHeaders(), array(), 'a new browser has empty reponse headers');
    /*******************/
    /* Utility methods */
    /*******************/
    $t->diag('Utility methods');
    $b = new sfWebBrowser(array(), $adapter);
    $t->is($b->setUserAgent('foo bar')->getUserAgent(), 'foo bar', 'setUserAgent() sets the user agent');
    $t->is($b->setResponseText('foo bar')->getResponseText(), 'foo bar', 'setResponseText() extracts the response');
    $t->is($b->setResponseCode('foo 123 bar')->getResponseCode(), '123', 'setResponseCode() extracts the three-digits code');
    $t->is($b->setResponseCode('foo 12 bar')->getResponseCode(), '', 'setResponseCode() fails silently when response status is incorrect');
    $t->is_deeply($b->setResponseHeaders(array('HTTP1.1 200 OK', 'foo: bar', 'bar: baz'))->getResponseHeaders(), array('Foo' => 'bar', 'Bar' => 'baz'), 'setResponseHeaders() extracts the headers array');
    $t->is_deeply($b->setResponseHeaders(array('ETag: "535a8-9fb-44ff4a13"', 'WWW-Authenticate: Basic realm="Myself"'))->getResponseHeaders(), array('ETag' => '"535a8-9fb-44ff4a13"', 'WWW-Authenticate' => 'Basic realm="Myself"'), 'setResponseHeaders() extracts the headers array and accepts response headers with several uppercase characters');
    $t->is_deeply($b->setResponseHeaders(array('HTTP1.1 200 OK', 'foo: bar', 'bar:baz', 'baz:bar'))->getResponseHeaders(), array('Foo' => 'bar'), 'setResponseHeaders() ignores malformed headers');
    /**************/
    /* Exceptions */
    /**************/
Пример #2
0
 protected final function printBrowserResponse(sfWebBrowser $b, $url, $printText = false)
 {
     echo "****************************\n";
     echo "COULDN'T GET REMOTE LOCATION: " . $url . "\n";
     echo "Response code: " . $b->getResponseCode() . "\n";
     echo "Response headers: ";
     print_r($b->getResponseHeaders());
     if ($printText) {
         echo "Response text: \n";
         echo $b->getResponseText();
     }
     echo "****************************\n";
     echo "\n";
 }