Issues (2)

tests/MementoTest.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\Memento\Tests;
11
12
use Behavioral\Memento\{Caretaker, Originator, CaretakerInterface, OriginatorInterface};
13
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...
14
15
class MementoTest extends PHPUnit_Framework_TestCase
16
{
17
    private CaretakerInterface $caretaker;
18
    private OriginatorInterface $originator;
19
20
    protected function setUp(): void
21
    {
22
        $this->originator = new Originator();
23
        $this->caretaker  = new Caretaker($this->originator);
24
25
        $this->originator->setState("on");
26
        $this->caretaker->save();
27
        $this->originator->setState("off");
28
    }
29
30
    public function testInstance(): void
31
    {
32
        $this->assertInstanceOf(Originator::class, $this->originator);
33
        $this->assertInstanceOf(Caretaker::class, $this->caretaker);
34
    }
35
36
    public function testState(): void
37
    {
38
        $this->assertEquals("off", $this->originator->getState());
39
    }
40
41
    public function testRestoringState(): void
42
    {
43
        $this->caretaker->undo();
44
        $this->assertEquals("on", $this->originator->getState());
45
    }
46
}
47