Slide 52
Slide 52 text
class CartTest extends \PHPUnit_Framework_TestCase
{
public function testCartImplementsCountable()
{
$this->assertInstanceOf('Countable', $this->cart);
}
public function testCartIsInitiallyEmpty()
{
$this->assertEquals(0, count($this->cart));
}
public function testCanAddOneProductToCart()
{
$this->cart->addProduct($this->product(500, false));
$this->assertEquals(1, count($this->cart));
}
public function testSubtotalSumsAllProductsInCart()
{
$this->cart->addProduct($this->product(2000));
$this->cart->addProduct($this->product(1500));
$this->assertEquals(3500, $this->cart->subtotal());
}
}