getResponseCode() public method

Accessor for last response code.
public getResponseCode ( ) : integer
return integer Last HTTP response code received.
 function testGet()
 {
     $browser = new SimpleBrowser();
     $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion());
     $this->assertTrue($browser->get('http://www.lastcraft.com/test/network_confirm.php'));
     $this->assertPattern('/target for the SimpleTest/', $browser->getContent());
     $this->assertPattern('/Request method.*?<dd>GET<\\/dd>/', $browser->getContent());
     $this->assertEqual($browser->getTitle(), 'Simple test target file');
     $this->assertEqual($browser->getResponseCode(), 200);
     $this->assertEqual($browser->getMimeType(), 'text/html');
 }
Exemplo n.º 2
0
 public function testShouldAccessWebsiteURLUsingTLS11()
 {
     $browser = new SimpleBrowser();
     $browser->get('https://tls1test.salesforce.com');
     $this->assertEqual($browser->getResponseCode(), 200);
 }
Exemplo n.º 3
0
 function testDeleteRequest()
 {
     $browser = new SimpleBrowser();
     $browser->delete($this->samples() . 'request_methods.php');
     $this->assertEqual($browser->getResponseCode(), 202);
     $this->assertPattern('/Your delete request was accepted/', $browser->getContent());
 }
Exemplo n.º 4
0
 function testGet()
 {
     $browser = new SimpleBrowser();
     $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion());
     $this->assertTrue($browser->get($this->samples() . 'file.html'));
     $this->assertPattern('/Link to SimpleTest/', $browser->getContent());
     $this->assertEqual($browser->getTitle(), 'Link to SimpleTest');
     $this->assertFalse($browser->getResponseCode());
     $this->assertEqual($browser->getMimeType(), '');
 }