lines[] = new OrderLine(12301, new Product(12, 'Something', 'Just something', 10.00), 1 ); $o->lines[] = new OrderLine(12302, new Product(21, 'Something', 'Just something', 20.00), 2 ); $this->assertEquals(123, $o->id, 'id'); $this->assertEquals(321, $o->customer->id, 'customer id'); $this->assertEquals(date('Y-m-d'), $o->orderdate, 'order date'); $this->assertEquals('????', $o->status, 'status'); $this->assertEquals(12301, $o->lines[0]->id, 'orderline 0 id'); $this->assertEquals(12, $o->lines[0]->product->id, 'orderline 0 product id'); $this->assertEquals(1, $o->lines[0]->quantity, 'orderline 0 quantity'); $this->assertEquals(12302, $o->lines[1]->id, 'orderline 0 id'); $this->assertEquals(21, $o->lines[1]->product->id, 'orderline 0 product id'); $this->assertEquals(2, $o->lines[1]->quantity, 'orderline 0 quantity'); } public function testTotalPrice() { $o = new Order(123, new Customer(321, 'ABC', '123 Somewhere Rd', '123456789', 'boss@abc.com'), date('Y-m-d'), '????'); $o->lines[] = new OrderLine(12301, new Product(12, 'Something', 'Just something', 10.00), 1 ); $o->lines[] = new OrderLine(12302, new Product(21, 'Something', 'Just something', 20.00), 2 ); $this->assertEquals(10.00, $o->lines[0]->getTotalPrice(), 'order line 0 total price'); $this->assertEquals(40.00, $o->lines[1]->getTotalPrice(), 'order line 1 total price'); $this->assertEquals(50.00, $o->getTotalPrice(), 'total price'); } } ?>