Passed
Push — master ( b40ba5...50a0fb )
by Johnny
31:49 queued 11s
created

anonymous//examples/Anonclass.php$0   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 28
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A Anonclass.php$0 ➔ run() 0 3 1
1
<?php
2
3
/**
4
 * Anonclass.php
5
 *
6
 * This file demonstrate how you could use Anonymous classes to
7
 * attach to the the test suite.
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
$suite = new TestSuite();
26
$suite->attach(
27
    /**
28
     * Anonymous class
29
     */
30
    new class extends TestCase {
31
32
        /**
33
         * Tell the TestCase what the
34
         * min reachable score is.
35
         *
36
         * @var int
37
         */
38
        protected int $minscore = 0;
39
40
        /**
41
         * Tell the TestCase what the
42
         * max reachable score is.
43
         *
44
         * @var int
45
         */
46
        protected int $maxscore = 10;
47
    
48
        /**
49
         * Run the test.
50
         *
51
         * @param ContainerInterface $container The storage container for the TestSuite.
52
         *
53
         * @return bool
54
         */
55
        public function run(ContainerInterface $container)
56
        {
57
            echo "Test case has run.\n";
58
        }
59
    }
60
)->run();
61
62
/**
63
 * Output:
64
 *
65
 * Test case has run.
66
 */
67