Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Uploaded request types file
Browse files Browse the repository at this point in the history
  • Loading branch information
lastcraft committed Nov 29, 2009
1 parent 7863613 commit c902495
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions test/acceptance_test.php
Expand Up @@ -9,7 +9,6 @@
class SimpleTestAcceptanceTest extends WebTestCase {
static function samples() {
return 'http://www.lastcraft.com/test/';
//return 'http://simpletest.localhost/test/site/';
}
}

Expand Down Expand Up @@ -121,8 +120,7 @@ function testGet() {
}
}

class TestOfRequestMethods { // extends UnitTestCase {

class TestOfRequestMethods extends UnitTestCase {
function samples() {
return SimpleTestAcceptanceTest::samples();
}
Expand All @@ -141,37 +139,37 @@ function testGetRequest() {

function testPostWithPlainEncoding() {
$browser = new SimpleBrowser();
$this->assertTrue($browser->post($this->samples() . 'request_methods.php', "A content message"));
$this->assertTrue($browser->post($this->samples() . 'request_methods.php', 'A content message'));
$this->assertEqual($browser->getResponseCode(), 406);
$this->assertPattern("/Please ensure content type is an XML format/", $browser->getContent());
$this->assertPattern('/Please ensure content type is an XML format/', $browser->getContent());
}

function testPostWithXmlEncoding() {
$browser = new SimpleBrowser();
$this->assertTrue($browser->post($this->samples() . 'request_methods.php', "<a><b>c</b></a>", "text/xml"));
$this->assertTrue($browser->post($this->samples() . 'request_methods.php', '<a><b>c</b></a>', 'text/xml'));
$this->assertEqual($browser->getResponseCode(), 201);
$this->assertPattern("/c/", $browser->getContent());
$this->assertPattern('/c/', $browser->getContent());
}

function testPutWithPlainEncoding() {
$browser = new SimpleBrowser();
$this->assertTrue($browser->put($this->samples() . 'request_methods.php', "A content message"));
$this->assertTrue($browser->put($this->samples() . 'request_methods.php', 'A content message'));
$this->assertEqual($browser->getResponseCode(), 406);
$this->assertPattern("/Please ensure content type is an XML format/", $browser->getContent());
$this->assertPattern('/Please ensure content type is an XML format/', $browser->getContent());
}

function testPutWithXmlEncoding() {
$browser = new SimpleBrowser();
$this->assertTrue($browser->put($this->samples() . 'request_methods.php', "<a><b>c</b></a>", "application/xml"));
$this->assertTrue($browser->put($this->samples() . 'request_methods.php', '<a><b>c</b></a>', 'application/xml'));
$this->assertEqual($browser->getResponseCode(), 201);
$this->assertPattern("/c/", $browser->getContent());
$this->assertPattern('/c/', $browser->getContent());
}

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());
$this->assertPattern('/Your delete request was accepted/', $browser->getContent());
}

}
Expand Down

0 comments on commit c902495

Please sign in to comment.