|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* TestSuiteExtension.php |
|
5
|
|
|
* |
|
6
|
|
|
* This file demonstrate how you can extend the TestSuite |
|
7
|
|
|
* class to add your own functionality to it. |
|
8
|
|
|
* |
|
9
|
|
|
* PHP version 7.4 |
|
10
|
|
|
* |
|
11
|
|
|
* @category Examples |
|
12
|
|
|
* @package RedboxTestSuite |
|
13
|
|
|
* @author Johnny Mast <[email protected]> |
|
14
|
|
|
* @license https://opensource.org/licenses/MIT MIT |
|
15
|
|
|
* @link https://github.com/johnnymast/redbox-testsuite |
|
16
|
|
|
* @since 1.0 |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
require __DIR__ . '/../vendor/autoload.php'; |
|
20
|
|
|
|
|
21
|
|
|
use Redbox\Testsuite\Interfaces\ContainerInterface; |
|
22
|
|
|
use Redbox\Testsuite\TestCase; |
|
23
|
|
|
use Redbox\Testsuite\TestSuite; |
|
24
|
|
|
|
|
25
|
|
|
class TestSuiteExtension extends TestSuite |
|
26
|
|
|
{ |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* This function will be called before every |
|
30
|
|
|
* test. |
|
31
|
|
|
* |
|
32
|
|
|
* @return void |
|
33
|
|
|
*/ |
|
34
|
|
|
public function beforeTest() |
|
35
|
|
|
{ |
|
36
|
|
|
echo "beforeTest called\n"; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* This function will be called after every |
|
41
|
|
|
* test. |
|
42
|
|
|
* |
|
43
|
|
|
* @return void |
|
44
|
|
|
*/ |
|
45
|
|
|
public function afterTest() |
|
46
|
|
|
{ |
|
47
|
|
|
echo "afterTest called\n"; |
|
48
|
|
|
} |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
class FirstTest extends TestCase |
|
52
|
|
|
{ |
|
53
|
|
|
/** |
|
54
|
|
|
* Tell the TestCase what the |
|
55
|
|
|
* min reachable score is. |
|
56
|
|
|
* |
|
57
|
|
|
* @var int |
|
58
|
|
|
*/ |
|
59
|
|
|
protected int $minscore = 0; |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Tell the TestCase what the |
|
63
|
|
|
* max reachable score is. |
|
64
|
|
|
* |
|
65
|
|
|
* @var int |
|
66
|
|
|
*/ |
|
67
|
|
|
protected int $maxscore = 3; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Run the test. |
|
71
|
|
|
* |
|
72
|
|
|
* @param ContainerInterface $container The storage container for the TestSuite. |
|
73
|
|
|
* |
|
74
|
|
|
* @return void |
|
75
|
|
|
*/ |
|
76
|
|
|
public function run(ContainerInterface $container) |
|
77
|
|
|
{ |
|
78
|
|
|
// Nothing here |
|
79
|
|
|
} |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
class SecondTest extends FirstTest |
|
83
|
|
|
{ |
|
84
|
|
|
|
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
$suite = new TestSuiteExtention(); |
|
|
|
|
|
|
88
|
|
|
$suite->attach([FirstTest::class, SecondTest::class]) |
|
89
|
|
|
->run(); |
|
90
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths