testContainsReturnsFalseWhenStringNotFoundInArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 1
Metric Value
c 2
b 1
f 1
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
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