HelpersTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 2
Bugs 1 Features 1
Metric Value
wmc 3
c 2
b 1
f 1
lcom 1
cbo 2
dl 0
loc 33
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 13 1
A testContainsReturnsFalseWhenStringNotFoundInArray() 0 4 1
A testContainsReturnsTrueWhenStringIsFoundInArray() 0 4 1
1
<?php
2
3
4
use Pyjac\ORM\Helpers;
5
6
class HelpersTest extends PHPUnit_Framework_TestCase
7
{
8
    /**
9
     * Test array.
10
     *
11
     * @var array
12
     */
13
    protected $testArray;
14
15
    protected function setUp()
16
    {
17
        $this->testArray = [
18
            'server has gone away',
19
            'no connection to the server',
20
            'Lost connection',
21
            'is dead or not enabled',
22
            'Error while sending',
23
            'decryption failed or bad record mac',
24
            'SSL connection has been closed unexpectedly',
25
            'Deadlock found when trying to get lock',
26
        ];
27
    }
28
29
    public function testContainsReturnsFalseWhenStringNotFoundInArray()
30
    {
31
        $this->assertFalse(Helpers::contains('PHP rocks', $this->testArray));
32
    }
33
34
    public function testContainsReturnsTrueWhenStringIsFoundInArray()
35
    {
36
        $this->assertTrue(Helpers::contains('Error while sending', $this->testArray));
37
    }
38
}
39