$t->diag('Simple DELETE request');
 $t->like($b->delete($dump_headers_url)->getResponseText(), '/\\[REQUEST_METHOD\\] => DELETE/', 'delete() performs a DELETE request');
 /*********************/
 /* Arbitrary request */
 /*********************/
 $t->diag('Arbitrary request');
 $t->like($b->call($dump_headers_url, 'MICHEL')->getResponseText(), '/\\[REQUEST_METHOD\\] => MICHEL/', 'call() supports any HTTP methods');
 /****************************/
 /* Response formats methods */
 /****************************/
 $t->diag('Response formats methods');
 $b = new sfWebBrowser(array(), $adapter);
 $b->get($example_site_url);
 $t->like($b->getResponseText(), '/<body .*>/', 'getResponseText() returns the response text');
 $t->unlike($b->getResponseBody(), '/<body>/', 'getResponseBody() returns the response body');
 $t->isa_ok($b->getResponseDom(), 'DOMDocument', 'getResponseDom() returns the response Dom');
 $t->isa_ok($b->getResponseDomCssSelector(), 'sfDomCssSelector', 'getResponseDomCssSelector() returns a CSS selector on the response Dom');
 $b->get('http://rss.cnn.com/rss/cnn_topstories.rss');
 $t->isa_ok($b->getResponseXml(), 'SimpleXMLElement', 'getResponseXml() returns the response as a SimpleXML Element');
 $b->get('http://www.w3.org/StyleSheets/home.css');
 try {
     $b->getResponseXml();
     $t->fail('Incorrect XML throws an exception');
 } catch (Exception $e) {
     $t->pass('Incorrect XML throws an exception');
 }
 try {
     /******************************/
     /* Absolute and relative URls */
     /******************************/
     $t->diag('Absolute and relative URls');
示例#2
0
    return;
} else {
    $t->pass('Login successful');
}
/*
 * Go back to site
 */
$t->comment('sfPaymentPayPal/sample');
$web_browser->get($sf_payment_paypal_test['application_url'] . '/sfPaymentPayPal/sample');
$t->comment('Pay with PayPal');
$web_browser->click('Pay with PayPal');
$t->comment('Go back to site');
// guessing the link and seller name
$t->comment('Guessing the link');
$ends_with = "'s Test Store";
$dom = $web_browser->getResponseDom();
$xpath = new DomXpath($dom);
if ($h1s = $xpath->query('//h1')) {
    foreach ($h1s as $h1) {
        $nodeValue = preg_replace(array('/\\s{2,}/', '/\\r\\n|\\n|\\r/'), array(' ', ''), $h1->nodeValue);
        $nodeEndsWith = substr($nodeValue, strlen($nodeValue) - strlen($ends_with));
        if ($nodeEndsWith == $ends_with) {
            $my_link = $nodeValue;
            $seller_name = str_replace($ends_with, "", $my_link);
            break;
        }
    }
}
if (!isset($my_link)) {
    $t->fail('Could not guess the link and seller name');
} else {