public function testDelete() { $productId = 1; $this->stockStatusMock->expects($this->atLeastOnce())->method('getProductId')->willReturn($productId); $this->stockRegistryStorage->expects($this->once())->method('removeStockStatus')->with($productId); $this->stockStatusResourceMock->expects($this->once())->method('delete')->with($this->stockStatusMock)->willReturnSelf(); $this->assertTrue($this->model->delete($this->stockStatusMock)); }
public function testSaveWithoutProductId() { $productId = 1; $this->stockItemMock->expects($this->any())->method('getProductId')->willReturn($productId); $this->productMock->expects($this->once())->method('load')->with($productId)->willReturnSelf(); $this->productMock->expects($this->once())->method('getId')->willReturn(null); $this->stockRegistryStorage->expects($this->never())->method('removeStockItem'); $this->stockRegistryStorage->expects($this->never())->method('removeStockStatus'); $this->assertEquals($this->stockItemMock, $this->model->save($this->stockItemMock)); }
public function testDelete() { $this->stockRegistryStorage->expects($this->once())->method('removeStock'); $this->stockResourceMock->expects($this->once())->method('delete')->with($this->stockMock)->willReturnSelf(); $this->assertTrue($this->model->delete($this->stockMock)); }