| Total Complexity | 5 |
| Total Lines | 38 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | class DelegationTest extends PHPUnit_Framework_TestCase |
||
| 22 | { |
||
| 23 | /** |
||
| 24 | * @var TeamLead |
||
| 25 | */ |
||
| 26 | private $teamLead; |
||
| 27 | |||
| 28 | protected function setUp() |
||
| 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 |
||
| 59 | } |
||
| 60 | } |
||
| 61 |