mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-30 12:14:36 +00:00
Add PATCH request method test; Separate success request tests
This commit is contained in:
@@ -17,6 +17,13 @@ class Test {
|
||||
}
|
||||
}
|
||||
|
||||
function test($instance, $before, $after) {
|
||||
$instance->server('server', $before, array('key' => 'REQUEST_METHOD'));
|
||||
PHPUnit_Framework_Assert::assertTrue($instance->curl->response === $before);
|
||||
$instance->server('server', $after, array('key' => 'REQUEST_METHOD'));
|
||||
PHPUnit_Framework_Assert::assertTrue($instance->curl->response === $after);
|
||||
}
|
||||
|
||||
function create_png() {
|
||||
// PNG image data, 1 x 1, 1-bit colormap, non-interlaced
|
||||
ob_start();
|
||||
|
||||
+15
-9
@@ -121,6 +121,11 @@ class CurlTest extends PHPUnit_Framework_TestCase {
|
||||
$this->assertTrue($test->curl->response === 'image/png');
|
||||
}
|
||||
|
||||
public function testPatchRequestMethod() {
|
||||
$test = new Test();
|
||||
$this->assertTrue($test->server('request_method', 'PATCH') === 'PATCH');
|
||||
}
|
||||
|
||||
public function testDelete() {
|
||||
$test = new Test();
|
||||
$this->assertTrue($test->server('server', 'DELETE', array(
|
||||
@@ -528,28 +533,29 @@ class CurlTest extends PHPUnit_Framework_TestCase {
|
||||
$curl->setOpt(CURLOPT_RETURNTRANSFER, false);
|
||||
}
|
||||
|
||||
public function testRequestMethodSuccessiveRequests() {
|
||||
public function testRequestMethodSuccessiveGetRequests() {
|
||||
$test = new Test();
|
||||
|
||||
function test($instance, $before, $after) {
|
||||
$instance->server('server', $before, array('key' => 'REQUEST_METHOD'));
|
||||
PHPUnit_Framework_Assert::assertTrue($instance->curl->response === $before);
|
||||
$instance->server('server', $after, array('key' => 'REQUEST_METHOD'));
|
||||
PHPUnit_Framework_Assert::assertTrue($instance->curl->response === $after);
|
||||
}
|
||||
|
||||
test($test, 'GET', 'POST');
|
||||
test($test, 'GET', 'PUT');
|
||||
test($test, 'GET', 'DELETE');
|
||||
}
|
||||
|
||||
public function testRequestMethodSuccessivePostRequests() {
|
||||
$test = new Test();
|
||||
test($test, 'POST', 'GET');
|
||||
test($test, 'POST', 'PUT');
|
||||
test($test, 'POST', 'DELETE');
|
||||
}
|
||||
|
||||
public function testRequestMethodSuccessivePutRequests() {
|
||||
$test = new Test();
|
||||
test($test, 'PUT', 'GET');
|
||||
test($test, 'PUT', 'POST');
|
||||
test($test, 'PUT', 'DELETE');
|
||||
}
|
||||
|
||||
public function testRequestMethodSuccessiveDeleteRequests() {
|
||||
$test = new Test();
|
||||
test($test, 'DELETE', 'GET');
|
||||
test($test, 'DELETE', 'POST');
|
||||
test($test, 'DELETE', 'PUT');
|
||||
|
||||
Reference in New Issue
Block a user