forked from bigcommerce/bigcommerce-api-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConnectionTest.php
43 lines (36 loc) · 1.06 KB
/
ConnectionTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace Bigcommerce\Test\Unit\Api;
use Bigcommerce\Api\Connection;
use PHPUnit\Framework\TestCase;
class ConnectionTest extends TestCase
{
/**
* @var \Bigcommerce\Api\Connection;
*/
protected $object;
public function setUp()
{
$this->object = new Connection();
}
public function testFailOnError()
{
$this->object->failOnError(false);
$this->assertAttributeSame(false, 'failOnError', $this->object);
$this->object->failOnError(true);
$this->assertAttributeSame(true, 'failOnError', $this->object);
}
public function testAddHeader()
{
$this->object->addHeader('Content-Length', 4);
$this->assertAttributeContains('Content-Length: 4', 'headers', $this->object);
}
/**
* @depends testAddHeader
*/
public function testRemoveHeader()
{
$this->object->addHeader('Content-Length', 4);
$this->object->removeHeader('Content-Length');
$this->assertAttributeNotContains('Content-Length: 4', 'headers', $this->object);
}
}