Constraint
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 3
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 0
lcom 0
cbo 0
dl 0
loc 3
c 1
b 0
f 0
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
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class should be in its own file to aid autoloaders.

Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.

Loading history...
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