Test Setup Failed
Push — test ( 24878d...6ecee8 )
by Jonathan
02:38
created

KintTestCase   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 4
lcom 1
cbo 5
1
<?php
2
3
namespace Kint\Test;
4
5
use Kint;
6
use Kint\Object\BlobObject;
7
use PHPUnit_Framework_TestCase;
8
use PHPUnit_Util_InvalidArgumentHelper;
9
10
abstract class KintTestCase extends PHPUnit_Framework_TestCase
11
{
12
    protected $kint_status;
13
    protected $char_encodings;
14
15
    public function setUp()
16
    {
17
        $this->kint_status = Kint::settings();
18
        $this->char_encodings = BlobObject::$char_encodings;
19
    }
20
21
    public function tearDown()
22
    {
23
        Kint::settings($this->kint_status);
24
        BlobObject::$char_encodings = $this->char_encodings;
25
    }
26
27
    /**
28
     * Asserts that a condition is true.
29
     *
30
     * @param array  $expected
31
     * @param string $actual
32
     * @param string $message
33
     *
34
     * @throws PHPUnit_Framework_Exception
35
     */
36
    public function assertLike(array $expected, $actual, $message = '')
37
    {
38
        if (!is_string($actual)) {
39
            throw PHPUnit_Util_InvalidArgumentHelper::factory(2, 'string');
40
        }
41
42
        self::assertThat($actual, new ContainsInOrderConstraint($expected), $message);
43
    }
44
}
45