Passed
Push — develop ( f33517...37b14c )
by Ilya
02:41
created

ActionsBagTest::test_get_method()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 9
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Hivokas\LaravelHandlers\Tests;
4
5
use Hivokas\LaravelHandlers\Support\ActionsBag;
6
7
class ActionsBagTest extends AbstractTestCase
8
{
9
    public function test_add_if_not_exists_method()
10
    {
11
        $bag = new ActionsBag;
12
13
        $this->assertEquals(count($bag->get()), 0);
14
15
        $bag->addIfNotExists('index');
16
17
        $this->assertEquals(count($bag->get()), 1);
18
19
        $bag->addIfNotExists('index');
20
21
        $this->assertEquals(count($bag->get()), 1);
22
    }
23
24
    public function test_delete_if_exists_method()
25
    {
26
27
        $bag = new ActionsBag;
28
29
        $bag->addIfNotExists('index');
30
31
        $this->assertEquals(count($bag->get()), 1);
32
33
        $bag->deleteIfExists('show');
34
35
        $this->assertEquals(count($bag->get()), 1);
36
37
        $bag->deleteIfExists('index');
38
39
        $this->assertEquals(count($bag->get()), 0);
40
    }
41
42
    public function test_get_method()
43
    {
44
        $bag = new ActionsBag;
45
46
        $bag->addIfNotExists('index');
47
48
        $bag->addIfNotExists('show');
49
50
        $this->assertEquals(array_sort_recursive(['index', 'show']), array_sort_recursive($bag->get()));
51
    }
52
53
    public function test_is_empty_method()
54
    {
55
        $bag = new ActionsBag;
56
57
        $this->assertTrue($bag->isEmpty());
58
59
        $bag->addIfNotExists('show');
60
61
        $this->assertFalse($bag->isEmpty());
62
    }
63
}
64