Test_TestCase
last analyzed

Complexity

Total Complexity 0

Size/Duplication

Total Lines 3
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 1

Importance

Changes 0
Metric Value
wmc 0
c 0
b 0
f 0
cbo 1
dl 0
loc 3
1
<?php
2
/*
3
 * This file is part of the ILess
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
trait TestCaseTrait {
10
    protected function prepareDataForProvider($values, $expected)
11
    {
12
        return array_map([$this, 'mapValuesWithExpected'], $values, $expected);
13
    }
14
15
    protected function mapValuesWithExpected($values, $expected)
16
    {
17
        return [$values, $expected];
18
    }
19
20
    protected function diag($message)
21
    {
22
        echo "\n" . $message . "\n";
23
    }
24
}
25
26
if(class_exists('\PHPUnit_Framework_TestCase')) {
27
    class Test_TestCase extends \PHPUnit_Framework_TestCase {
28
        use TestCaseTrait;
29
    }
30
} else {
31
    // phpunit 6+
32
    class Test_TestCase extends \PHPUnit\Framework\TestCase {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The type Test_TestCase has been defined more than once; this definition is ignored, only the first definition in this file (L27-29) is considered.

This check looks for classes that have been defined more than once in the same file.

If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.

This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.

Loading history...
33
        use TestCaseTrait;
34
    }
35
}
36