/
CoffeeSupplyTest.php
52 lines (45 loc) · 1.18 KB
/
CoffeeSupplyTest.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require_once 'Supply.php';
require_once 'CoffeeSupply.php';
class CoffeeSupplyTest extends PHPUnit_Framework_TestCase
{
public function testCoffeeSupplyReturnsTheBeverageNameCorrectly()
{
$supply = new CoffeeSupply(5);
$this->assertEquals('Coffee', $supply->getBeverageName());
}
public function testCoffeeSuppliesCanBeCreatedWithASpecificQuantity()
{
$supply = new CoffeeSupply(5);
$this->assertEquals(5, $supply->getQuantity());
}
/**
* @expectedException PHPUnit_Framework_Error
*/
public function testCoffeeSuppliesMustBeExplicitlyNumbered()
{
new CoffeeSupply;
}
public static function invalidCoffeeSuppliesNumber()
{
return array(
array(1),
array(2),
array(3),
array(4),
array(6),
array(7),
array(8),
array(9),
array(11)
);
}
/**
* @dataProvider invalidCoffeeSuppliesNumber
* @expectedException InvalidArgumentException
*/
public function testCoffeeSuppliesMustComeInMultiplesOfFive($number)
{
new CoffeeSupply($number);
}
}