Test Failed
Branch master (9acec7)
by Agel_Nash
02:58
created

checkBlockTest   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 11
c 0
b 0
f 0
dl 0
loc 78
rs 10

11 Methods

Rating   Name   Duplication   Size   Complexity  
A testNoBlockedAfter() 0 5 1
A testYesBlockedAfter() 0 5 1
A testNoBlocked() 0 4 1
A testNoBlockedUntil() 0 5 1
A testYesBlockedUntil() 0 5 1
A setUp() 0 5 1
A testNoBlockedUntilEnd() 0 5 1
A testYesBlockedAfterEnd() 0 5 1
A testBlocked() 0 4 1
A testNoBlockedAfterEnd() 0 5 1
A testYesBlockedUntilEnd() 0 5 1
1
<?php namespace DocLister\Tests\MODxAPI\modUsers;
2
3
use DocLister\Tests\MODxAPI\apiAbstract;
4
5
class checkBlockTest extends apiAbstract
6
{
7
    /** @var \modUsers */
8
    protected $modUsers = null;
9
10
    public function setUp()
11
    {
12
        parent::setUp();
13
        $this->modUsers = $this->mockModUsers();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->mockModUsers() of type PHPUnit_Framework_MockObject_MockObject is incompatible with the declared type modUsers of property $modUsers.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
14
        $this->setProperty($this->modUsers, 'id', 1);
15
    }
16
17
    public function testNoBlockedUntil()
18
    {
19
        $this->modUsers->set('blockeduntil', strtotime("+1 DAY"))
20
            ->set('blocked', 0);
21
        $this->assertEquals(true, $this->modUsers->checkBlock());
22
    }
23
24
    public function testNoBlockedAfter()
25
    {
26
        $this->modUsers->set('blockedafter', strtotime("+1 DAY"))
27
            ->set('blocked', 0);
28
        $this->assertEquals(false, $this->modUsers->checkBlock());
29
    }
30
31
    public function testNoBlockedUntilEnd()
32
    {
33
        $this->modUsers->set('blockeduntil', strtotime("-1 DAY"))
34
            ->set('blocked', 0);
35
        $this->assertEquals(false, $this->modUsers->checkBlock());
36
    }
37
38
    public function testNoBlockedAfterEnd()
39
    {
40
        $this->modUsers->set('blockedafter', strtotime("-1 DAY"))
41
            ->set('blocked', 0);
42
        $this->assertEquals(true, $this->modUsers->checkBlock());
43
    }
44
45
    public function testYesBlockedUntil()
46
    {
47
        $this->modUsers->set('blockeduntil', strtotime("+1 DAY"))
48
            ->set('blocked', 1);
49
        $this->assertEquals(true, $this->modUsers->checkBlock());
50
    }
51
52
    public function testYesBlockedAfter()
53
    {
54
        $this->modUsers->set('blockedafter', strtotime("+1 DAY"))
55
            ->set('blocked', 1);
56
        $this->assertEquals(false, $this->modUsers->checkBlock());
57
    }
58
59
    public function testYesBlockedUntilEnd()
60
    {
61
        $this->modUsers->set('blockeduntil', strtotime("-1 DAY"))
62
            ->set('blocked', 1);
63
        $this->assertEquals(false, $this->modUsers->checkBlock());
64
    }
65
66
    public function testYesBlockedAfterEnd()
67
    {
68
        $this->modUsers->set('blockedafter', strtotime("-1 DAY"))
69
            ->set('blocked', 1);
70
        $this->assertEquals(true, $this->modUsers->checkBlock());
71
    }
72
73
    public function testBlocked()
74
    {
75
        $this->modUsers->set('blocked', 1);
76
        $this->assertEquals(true, $this->modUsers->checkBlock());
77
    }
78
79
    public function testNoBlocked()
80
    {
81
        $this->modUsers->set('blocked', 0);
82
        $this->assertEquals(false, $this->modUsers->checkBlock());
83
    }
84
}