Completed
Pull Request — master (#4)
by Korotkov
02:46
created

DelegationTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 3 1
A getTeamLead() 0 3 1
A testMiddle() 0 4 1
A testJunior() 0 4 1
A testTeamLead() 0 6 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 Fundamental\Delegation\Tests;
11
12
use Fundamental\Delegation\TeamLead;
13
use Fundamental\Delegation\JuniorDeveloper;
14
use Fundamental\Delegation\MiddleDeveloper;
15
use PHPUnit\Framework\TestCase as PHPUnit_Framework_TestCase;
16
17
/**
18
 * Class DelegationTest
19
 * @package Fundamental\Delegation\Tests
20
 */
21
class DelegationTest extends PHPUnit_Framework_TestCase
22
{
23
    /**
24
     * @var TeamLead
25
     */
26
    private $teamLead;
27
28
    protected function setUp()
29
    {
30
        $this->teamLead = new TeamLead();
31
    }
32
33
    public function testTeamLead()
34
    {
35
        $this->assertEquals("Some excellent code", $this->getTeamLead()->writeCode());
36
37
        $this->getTeamLead()->delegateTo($this->getTeamLead());
38
        $this->assertEquals("Some excellent code", $this->getTeamLead()->getCodeFromDeveloper());
39
    }
40
41
    public function testMiddle()
42
    {
43
        $this->getTeamLead()->delegateTo(new MiddleDeveloper());
44
        $this->assertEquals("Some regular code", $this->getTeamLead()->getCodeFromDeveloper());
45
    }
46
47
    public function testJunior()
48
    {
49
        $this->getTeamLead()->delegateTo(new JuniorDeveloper());
50
        $this->assertEquals("Some really bad code", $this->getTeamLead()->getCodeFromDeveloper());
51
    }
52
53
    /**
54
     * @return TeamLead
55
     */
56
    public function getTeamLead(): TeamLead
57
    {
58
        return $this->teamLead;
59
    }
60
}
61