TestCase   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 34
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A expectException() 0 4 1
A expectExceptionMessage() 0 9 2
A expectExceptionMessageRegExp() 0 9 2
1
<?php
2
/*
3
 * Ensures compatibility with PHPUnit < 6.x
4
 */
5
namespace PHPUnit\Framework\Constraint {
6
    if (!class_exists('PHPUnit\Framework\Constraint\Constraint') && class_exists('PHPUnit_Framework_Constraint')) {
7
        abstract class Constraint extends \PHPUnit_Framework_Constraint
8
        {
9
        }
10
    }
11
}
12
namespace PHPUnit\Framework {
13
    if (!class_exists('PHPUnit\Framework\TestCase') && class_exists('PHPUnit_Framework_TestCase')) {
14
        abstract class TestCase extends \PHPUnit_Framework_TestCase
15
        {
16
            /**
17
             * @param string $exception
18
             */
19
            public function expectException($exception)
20
            {
21
                $this->setExpectedException($exception);
22
            }
23
            /**
24
             * @param string $message
25
             */
26
            public function expectExceptionMessage($message)
27
            {
28
                $parentClassMethods = get_class_methods('PHPUnit_Framework_TestCase');
29
                if (in_array('expectExceptionMessage', $parentClassMethods)) {
30
                    parent::expectExceptionMessage($message);
31
                    return;
32
                }
33
                $this->setExpectedException($this->getExpectedException(), $message);
34
            }
35
            /**
36
             * @param string $messageRegExp
37
             */
38
            public function expectExceptionMessageRegExp($messageRegExp)
39
            {
40
                $parentClassMethods = get_class_methods('PHPUnit_Framework_TestCase');
41
                if (in_array('expectExceptionMessageRegExp', $parentClassMethods)) {
42
                    parent::expectExceptionMessageRegExp($messageRegExp);
43
                    return;
44
                }
45
                $this->setExpectedExceptionRegExp($this->getExpectedException(), $messageRegExp);
46
            }
47
        }
48
    }
49
}
50