/** * @covers ::getStore * @covers ::setStore */ public function testStore() { $product = new StorePurchase(); $store = $product->getStore(); $this->assertInstanceOf('CL\\Purchases\\Store', $store); $this->assertTrue($store->isVoid()); $store = new Store(); $product->setStore($store); $this->assertSame($store, $product->getStore()); }
/** * @covers ::addPurchaseItem */ public function testAddPurchaseItem() { $purchase = $this->getMock('CL\\Purchases\\Purchase', ['getStorePurchaseForStore']); $store = new Store(); $storePurchase = new StorePurchase(); $storePurchase->setStore($store); $purchase->getStorePurchases()->add($storePurchase); $purchase->expects($this->once())->method('getStorePurchaseForStore')->with($this->identicalTo($store))->will($this->returnValue($storePurchase)); $purchaseItem = new PurchaseItem(); $purchase->addPurchaseItem($store, $purchaseItem); $this->assertTrue($purchase->getItems()->has($purchaseItem)); $this->assertTrue($storePurchase->getItems()->has($purchaseItem)); }