$product->getSellingPrice()... // ProductTest.php public function test_can_get_selling_price() { $product = new Product('Shampoo', 600); $this->assertEquals(600, $product->getSellingPrice()); }
500); $orderItem = new OrderItem($product, 3); $this->assertEquals(1500, $orderItem->getTotalPrice()); } Now this test will actually fail when we change the API of Product!
300); $toothpaste = new Product('Toothpaste', 500); $deodorant = new Product('Deodorant', 700); $items = new Collection([ new OrderItem($shampoo, 1), new OrderItem($toothpaste, 1), new OrderItem($deodorant, 1), ]); $order = new Order($items); $this->assertEquals(1500, $order->getTotalPrice()); } All implementations are green!