Completed
Push — master ( aea954...9f22d1 )
by Iman
1312:51 queued 1306:32
created

Response::forbiddenStatus()   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 0
crap 1
1
<?php
2
3
namespace Imanghafoori\HeyMan\MakeSure\Expectations;
4
5
class Response
6
{
7
    private $last;
8
9
    /**
10
     * Response constructor.
11
     *
12
     * @param $last
13
     */
14 13
    public function __construct($last)
15
    {
16 13
        $this->last = $last;
17 13
    }
18
19 1
    public function redirect($url, $status = null)
20
    {
21 1
        $this->last->assertion[] = ['type' => 'assertRedirect', 'value' => $url];
22
23 1
        if (!is_null($status)) {
24 1
            $this->last->assertion[] = ['type' => 'assertStatus', 'value' => $status];
25
        }
26
27 1
        return $this;
28
    }
29
30 12
    public function statusCode($code)
31
    {
32 12
        $this->last->assertion[] = ['type' => 'assertStatus', 'value' => $code];
33
34 12
        return $this;
35
    }
36
37
    public function success()
38
    {
39
        $this->last->assertion[] = ['type' => 'assertSuccessful', 'value' => null];
40
    }
41
42 1
    public function withError($value)
43
    {
44 1
        $this->last->assertion[] = ['type' => 'assertSessionHasErrors', 'value' => $value];
45
46 1
        return $this;
47
    }
48
49 8
    public function forbiddenStatus()
50
    {
51 8
        return $this->statusCode(403);
52
    }
53
}
54