Completed
Push — master ( 0501a9...9176f8 )
by Iman
13:27 queued 10:05
created

Chain::addAssertion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
1
<?php
2
3
namespace Imanghafoori\HeyMan\MakeSure;
4
5
class Chain
6
{
7
    private $phpunit;
8
9 33
    public function __construct($phpunit)
10
    {
11 33
        $this->phpunit = $phpunit;
12 33
    }
13
14
    public $http = [];
15
16
    public $assertion = [];
17
18
    public $event;
19
20
    public $exception;
21
22 33
    public function __destruct()
23
    {
24 33
        (new CheckExpectations($this, $this->phpunit))->check();
25 32
    }
26
27
    /**
28
     * @param $uri
29
     * @param array $data
30
     * @param array $headers
31
     * @param $str
32
     */
33 6
    public function http($uri, array $data, array $headers, $str)
34
    {
35 6
        $this->http = [
36 6
            'method'  => $str,
37 6
            'url'     => $uri,
38 6
            'data'    => $data,
39 6
            'headers' => $headers,
40
        ];
41 6
    }
42
43
    /**
44
     * @param $url
45
     * @param $str
46
     */
47 28
    public function addAssertion($str, $url = null)
48
    {
49 28
        $this->assertion[] = ['type' => $str, 'value' => $url];
50 28
    }
51
}
52