Passed
Pull Request — master (#5)
by Jonas
01:27
created

ArrayHasTest::testWillReturnFalseIfNotAvailable()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 6
rs 9.4285
c 1
b 0
f 0
ccs 5
cts 5
cp 1
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace ArrayHelpers;
4
5
use PHPUnit\Framework\TestCase;
6
7
class ArrayHasTest extends TestCase
8
{
9 1
    public function testWillReturnFalseIfNotAvailable()
10
    {
11 1
        $data = [];
12 1
        $key = 'foo';
13 1
        $this->assertFalse(
14 1
            Arr::has($data, $key)
15
        );
16 1
    }
17
18 1
    public function testWillReturnTrueIfAvailable()
19
    {
20
        $data = [
21 1
            'foo' => 'fighters',
22
            'bar' => 'tenders',
23
        ];
24 1
        $this->assertTrue(
25 1
            Arr::has($data, 'foo')
26
        );
27 1
    }
28
29 1 View Code Duplication
    public function testWillFindUsingDotNotation()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
    {
31
        $data = [
32 1
            'i' => [
33
                "can't" => [
34
                    'get' => [
35
                        'no' => 'satisfaction',
36
                    ],
37
                ],
38
            ],
39
        ];
40 1
        $key = "i.can't.get.no";
41 1
        $this->assertTrue(
42 1
            Arr::has($data, $key)
43
        );
44 1
    }
45
}
46