Passed
Pull Request — master (#1312)
by Michael
08:36 queued 02:22
created

KeyAbstractTest::testConstruct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Xmf\Test\Key;
6
7
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
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...
8
9
use Xmf\Key\ArrayStorage;
10
use Xmf\Key\KeyAbstract;
11
use Xmf\Key\StorageInterface;
12
13
class KeyAbstractTest extends TestCase
14
{
15
    /**
16
     * @var StorageInterface
17
     */
18
    protected $storage;
19
    /**
20
     * @var KeyAbstract
21
     */
22
    protected $object;
23
24
    /**
25
     * Sets up the fixture, for example, opens a network connection.
26
     * This method is called before a test is executed.
27
     */
28
    protected function setUp(): void
29
    {
30
        $this->storage = new ArrayStorage();
31
        $this->object  = $this->getMockForAbstractClass(KeyAbstract::class, [$this->storage, 'test']);
32
    }
33
34
    /**
35
     * Tears down the fixture, for example, closes a network connection.
36
     * This method is called after a test is executed.
37
     */
38
    protected function tearDown(): void
39
    {
40
    }
41
42
    public function testConstruct()
43
    {
44
        $this->assertInstanceOf(KeyAbstract::class, $this->object);
45
46
        $class  = new \ReflectionClass(KeyAbstract::class);
47
        $method = $class->getMethod('__construct');
48
        $this->assertFalse($method->isAbstract());
49
    }
50
51
    public function testMethodsExist()
52
    {
53
        $this->assertTrue(method_exists($this->object, 'getSigning'));
54
        $this->assertTrue(method_exists($this->object, 'getVerifying'));
55
        $this->assertTrue(method_exists($this->object, 'create'));
56
        $this->assertTrue(method_exists($this->object, 'kill'));
57
    }
58
}
59