/* Error management */ /********************/ $t->diag('Error management'); try { $b->get('http://nonexistent'); $t->fail('an exception is thrown when an adapter error occurs'); } catch (Exception $e) { $t->pass('an exception is thrown when an adapter error occurs'); } $t->is($b->get($example_site_url . '/nonexistentpage.html')->responseIsError(), true, 'responseIsError() returns true when response is an error'); $t->is($b->get($example_site_url)->responseIsError(), false, 'responseIsError() returns false when response is not an error'); /*******************/ /* Browser restart */ /*******************/ $t->diag('Browser restart'); $b->restart(); try { $b->reload(); $t->fail('restart() reinitializes the browser history'); } catch (Exception $e) { $t->pass('restart() reinitializes the browser history'); } $t->is($b->getResponseText(), '', 'restart() reinitializes the response'); /*************/ /* Redirects */ /*************/ $t->diag('Redirects'); $b = new sfWebBrowser(array(), $adapter); $b->get('http://www.symfony-project.com/trac/wiki/sfUJSPlugin'); $t->like($b->getResponseText(), '/learn more about the unobtrusive approach/', 'follows 302 redirect after a GET'); $b = new myTestWebBrowser(array(), $adapter);