Passed
Pull Request — master (#1)
by Korotkov
01:49
created

BuilderTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 36
rs 10
c 1
b 0
f 1
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getComputer() 0 3 1
A testInstance() 0 3 1
A setUp() 0 5 1
A testValues() 0 7 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * @author    : Korotkov Danila <[email protected]>
7
 * @copyright Copyright (c) 2018, Korotkov Danila
8
 * @license   http://www.gnu.org/licenses/gpl.html GNU GPLv3.0
9
 */
10
11
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...
12
use Creational\Builder\DanilaMaster;
13
use Creational\Builder\Computer;
14
15
/**
16
 * Class FactoryMethodTest
17
 */
18
class BuilderTest extends PHPUnit_Framework_TestCase
19
{
20
21
    /**
22
     * @var
23
     */
24
    protected $computer;
25
26
27
    protected function setUp(): void
28
    {
29
        $master = new DanilaMaster();
30
        $master->buildComputer('Yosemite');
31
        $this->computer = $master->getComputer();
32
    }
33
34
    public function testInstance()
35
    {
36
        $this->assertInstanceOf(Computer::class, $this->getComputer());
37
    }
38
39
    public function testValues()
40
    {
41
        $this->assertEquals($this->getComputer()->changeSoftware('Mavericks')->getSoftware(), 'Mavericks');
42
        $this->assertEquals($this->getComputer()->increaseHdd()->getHdd(), 1000);
43
        $this->assertEquals($this->getComputer()->increaseRam()->getRam(), 8192);
44
        $this->assertEquals($this->getComputer()->overclockGpu()->getGpu(), 3072);
45
        $this->assertEquals($this->getComputer()->overclockCpu()->getCpu(), 2500);
46
    }
47
48
    /**
49
     * @return mixed
50
     */
51
    public function getComputer()
52
    {
53
        return $this->computer;
54
    }
55
}
56