Completed
Push — master ( 0a797c...b034af )
by Korotkov
03:59 queued 02:35
created

BuilderTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
dl 0
loc 31
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testInstance() 0 11 1
A getMaster() 0 3 1
A setUp() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author    : Korotkov Danila <[email protected]>
7
 * @license   https://mit-license.org/ MIT
8
 */
9
10
namespace Creational\Builder\Tests;
11
12
use Creational\Builder\Master;
13
use Creational\Builder\DesktopBuilder;
14
use Creational\Builder\AbstractComputer;
15
use PHPUnit\Framework\TestCase as PHPUnit_Framework_TestCase;
16
17
/**
18
 * Class BuilderTest
19
 * @package Creational\Builder\Tests
20
 */
21
class BuilderTest extends PHPUnit_Framework_TestCase
22
{
23
    /**
24
     * @var Master
25
     */
26
    private $master;
27
28
    protected function setUp(): void
29
    {
30
        $this->master = new Master();
31
    }
32
33
    public function testInstance()
34
    {
35
        $this->getMaster()->setBuilder(new DesktopBuilder());
36
        $this->getMaster()->getBuilder()
37
            ->setParam('hdd', 1024)
38
            ->setParam('ram', 8192)
39
            ->setParam('cpu', 3000)
40
            ->setParam('gpu', 5000)
41
            ->setParam('software', 'UNIX');
42
43
        $this->assertInstanceOf(AbstractComputer::class, $this->getMaster()->build());
44
    }
45
46
    /**
47
     * @return Master
48
     */
49
    public function getMaster(): Master
50
    {
51
        return $this->master;
52
    }
53
}
54