Completed
Push — master ( 06ed76...0f3f4f )
by WEBEWEB
06:00 queued 14s
created

CURLDeleteRequestTest::testCall()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
/**
4
 * This file is part of the curl-library package.
5
 *
6
 * (c) 2017 NdC/WBW
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\CURL\Tests\Request;
13
14
use WBW\Library\CURL\Request\CURLDeleteRequest;
15
16
/**
17
 * CURL DELETE request test.
18
 *
19
 * @author NdC/WBW <https://github.com/webeweb/>
20
 * @package WBW\Library\CURL\Tests\Request
21
 * @final
22
 */
23
final class CURLDeleteRequestTest extends AbstractCURLRequestTest {
24
25
	/**
26
	 * Tests __construct() method.
27
	 *
28
	 * @return void
29
	 */
30
	public function testConstructor() {
31
32
		$obj = new CURLDeleteRequest($this->configuration, self::RESOURCE_PATH);
33
34
		$this->assertEquals($this->configuration, $obj->getConfiguration());
35
		$this->assertEquals([], $obj->getHeaders());
36
		$this->assertEquals(CURLDeleteRequest::METHOD_DELETE, $obj->getMethod());
37
		$this->assertEquals([], $obj->getPostData());
38
		$this->assertEquals([], $obj->getQueryData());
39
		$this->assertEquals("testCall.php", $obj->getResourcePath());
40
	}
41
42
	/**
43
	 * Tests call() method.
44
	 *
45
	 * @return void
46
	 */
47
	public function testCall() {
48
49
		$obj = new CURLDeleteRequest($this->configuration, self::RESOURCE_PATH);
50
51
		$obj->addHeader("header", "header");
52
		$obj->addQueryData("queryData", "queryData");
53
54
		$res = $obj->call();
55
56
		$this->assertContains("header: header", $res->getRequestHeader());
57
		$this->assertContains("queryData=queryData", $res->getRequestURL());
58
		$this->assertEquals(CURLDeleteRequest::METHOD_DELETE, json_decode($res->getResponseBody(), true)["method"]);
59
		$this->assertEquals(200, $res->getResponseInfo()["http_code"]);
60
	}
61
62
}
63