public function testOrderData() { $order = new Order(); $now = new \DateTime(); $order->setOrderDate($now); $jamesBond = new \Vespolina\Entity\Partner\Partner(); $jamesBond->setName('james bond'); $order->setCustomer($jamesBond); $order->setCustomerNotes('i want it to be pink'); $order->setInternalNotes('lizzen to me very carefully, i shall only say thiz onze'); $this->assertEquals('i want it to be pink', $order->getCustomerNotes()); $this->assertEquals('lizzen to me very carefully, i shall only say thiz onze', $order->getInternalNotes()); $this->assertEquals($now, $order->getOrderDate()); $this->assertEquals('james bond', $order->getCustomer()->getName()); }
public function testIsValidOpenOrder() { $mgr = $this->createOrderManager(); $order = null; $this->assertFalse($mgr->isValidOpenOrder($order), 'a null for an order should return false'); $order = new Order(); $customer = new Partner(); $customer->setName('Valid Customer'); $order->setCustomer($customer); $wrongCustomer = new Partner(); $wrongCustomer->setName('Wrong Customer'); $this->assertFalse($mgr->isValidOpenOrder($order, $wrongCustomer), 'a passed customer must not matching the customer in the order should return false'); $order->setState(OrderState::LOCKED); $this->assertFalse($mgr->isValidOpenOrder($order), 'an order not in an open state should return false'); $order->setState(OrderState::OPEN); $this->assertTrue($mgr->isValidOpenOrder($order), 'an order meeting all of the conditions should return true'); $this->assertTrue($mgr->isValidOpenOrder($order, $customer), 'an order with customer meeting all of the conditions should return true'); }