public function testCreateEmptyCartForCustomerReturnExistsQuote() { $storeId = 345; $userId = 567; $quoteMock = $this->getMock('\\Magento\\Quote\\Model\\Quote', [], [], '', false); $this->quoteRepositoryMock->expects($this->once())->method('getActiveForCustomer')->with($userId)->willReturn($quoteMock); $this->quoteRepositoryMock->expects($this->never())->method('create')->willReturn($quoteMock); $this->quoteRepositoryMock->expects($this->once())->method('save')->with($quoteMock); $this->storeManagerMock->expects($this->once())->method('getStore')->willReturnSelf(); $this->storeManagerMock->expects($this->once())->method('getStoreId')->willReturn($storeId); $this->model->createEmptyCartForCustomer($userId); }