FirstTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 27
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 2 1
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();
0 ignored issues
show
Bug introduced by
The type TestSuiteExtention was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
88
$suite->attach([FirstTest::class, SecondTest::class])
89
    ->run();
90