Issues (1)

tests/CommandTest.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author  : Jagepard <[email protected]>
7
 * @license https://mit-license.org/ MIT
8
 */
9
10
namespace Behavioral\Command\Tests;
11
12
use Behavioral\Command\{
13
    Lamp,
14
    ToggleCommand,
15
    TurnOnCommand,
16
    TurnOffCommand,
17
    DeviceInterface
18
};
19
use PHPUnit\Framework\TestCase as PHPUnit_Framework_TestCase;
0 ignored issues
show
The type PHPUnit\Framework\TestCase 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...
20
21
class CommandTest extends PHPUnit_Framework_TestCase
22
{
23
    private DeviceInterface $device;
24
25
    protected function setUp(): void
26
    {
27
        $this->device = new Lamp();
28
        $this->device->setCommand("on", new TurnOnCommand());
29
        $this->device->setCommand("off", new TurnOffCommand());
30
        $this->device->setCommand("toggle", new ToggleCommand());
31
    }
32
33
    public function testExecute(): void
34
    {
35
        ob_start();
36
        $this->device->execute("on");
37
        $on = ob_get_clean();
38
        $this->assertEquals($on, sprintf("The Light turns %s \n", "on"));
39
40
        ob_start();
41
        $this->device->execute("off");
42
        $off = ob_get_clean();
43
        $this->assertEquals($off, sprintf("The Light turns %s \n", "off"));
44
45
        ob_start();
46
        $this->device->execute("toggle");
47
        $toggle = ob_get_clean();
48
        $this->assertEquals($toggle, sprintf("The Light turns %s \n", "on"));
49
50
        ob_start();
51
        $this->device->execute("toggle");
52
        $toggle = ob_get_clean();
53
        $this->assertEquals($toggle, sprintf("The Light turns %s \n", "off"));
54
    }
55
}
56