-
Notifications
You must be signed in to change notification settings - Fork 0
/
DecoratorTest.php
36 lines (30 loc) · 1.09 KB
/
DecoratorTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Tests;
use Patterns\Structural\Decorator\Americano;
use Patterns\Structural\Decorator\Espresso;
use Patterns\Structural\Decorator\Milk;
use Patterns\Structural\Decorator\Mocha;
class DecoratorTest extends BaseTestCase
{
public function testCanCreateEspresso()
{
$beverage = new Espresso();
$this->assertEquals('Эспрессо', $beverage->getDescription());
$this->assertEquals(99, $beverage->getCost());
}
public function testCanCreateEspressoWithMocha()
{
$beverage = new Espresso();
$beverage = new Mocha($beverage);
$this->assertEquals('Эспрессо, шоколад', $beverage->getDescription());
$this->assertEquals(149, $beverage->getCost());
}
public function testCanCreateAmericanoWithMilkAndMocha()
{
$beverage = new Americano();
$beverage = new Mocha($beverage);
$beverage = new Milk($beverage);
$this->assertEquals('Американо, шоколад, молоко', $beverage->getDescription());
$this->assertEquals(229, $beverage->getCost());
}
}