Passed
Push — master ( 45dd5d...0501a9 )
by Iman
07:11
created

Chain::addAssertion()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 2
1
<?php
2
3
namespace Imanghafoori\HeyMan\MakeSure;
4
5
class Chain
6
{
7
    private $phpunit;
8
9 32
    public function __construct($phpunit)
10
    {
11 32
        $this->phpunit = $phpunit;
12 32
    }
13
14
    public $http = [];
15
16
    public $assertion = [];
17
18
    public $event;
19
20
    public $exception;
21
22 32
    public function __destruct()
23
    {
24 32
        (new CheckExpectations($this, $this->phpunit))->check();
25 31
    }
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
    public function addAssertion($str, $url = null)
48
    {
49
        $this->assertion[] = ['type' => $str, 'value' => $url];
50
    }
51
}