BuilderTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
eloc 2
c 5
b 0
f 0
dl 0
loc 4
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
/**
4
 * @author  : Jagepard <[email protected]>
5
 * @license https://mit-license.org/ MIT
6
 */
7
8
namespace Creational\Builder\Tests;
9
10
use Creational\Builder\{Order,
11
    Director,
12
    PCBuilder,
13
    Hardware\Cpu,
14
    Hardware\Gpu,
15
    Hardware\Ram,
16
    Hardware\Ssd,
17
    Hardware\Hdd,
18
    Hardware\Motherboard,
19
    Interfaces\ComputerInterface
20
};
21
use PHPUnit\Framework\TestCase as 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...
22
23
class BuilderTest extends PHPUnit_Framework_TestCase
24
{
25
    private ComputerInterface $desktop;
26
27
    protected function setUp(): void
28
    {
29
        $employe = new Director();
30
        $this->desktop = $employe->build(new PCBuilder());
31
    }
32
33
    public function testInstance()
34
    {
35
        $this->assertInstanceOf(ComputerInterface::class, $this->desktop);
36
    }
37
38
    public function testParts()
39
    {
40
        $this->assertEquals(Order::MB, $this->desktop->getComponent(Motherboard::class)->getValue());
41
        $this->assertEquals(Order::CPU, $this->desktop->getComponent(Cpu::class)->getValue());
42
        $this->assertEquals(Order::RAM, $this->desktop->getComponent(Ram::class)->getValue());
43
        $this->assertEquals(Order::GPU, $this->desktop->getComponent(Gpu::class)->getValue());
44
        $this->assertEquals(Order::SSD, $this->desktop->getComponent(Ssd::class)->getValue());
45
        $this->assertEquals(Order::HDD, $this->desktop->getComponent(Hdd::class)->getValue());
46
    }
47
}
48