/** * test order list service */ public function testInvoke() { $this->orderRepositoryMock->expects($this->once())->method('find')->with($this->equalTo($this->searchCriteriaMock))->will($this->returnValue([$this->orderMock])); $this->orderMapperMock->expects($this->once())->method('extractDto')->with($this->equalTo($this->orderMock))->will($this->returnValue($this->dataObjectMock)); $this->searchResultsBuilderMock->expects($this->once())->method('setItems')->with($this->equalTo([$this->dataObjectMock]))->will($this->returnSelf()); $this->searchResultsBuilderMock->expects($this->once())->method('setTotalCount')->with($this->equalTo(1))->will($this->returnSelf()); $this->searchResultsBuilderMock->expects($this->once())->method('setSearchCriteria')->with($this->equalTo($this->searchCriteriaMock))->will($this->returnSelf()); $this->searchResultsBuilderMock->expects($this->once())->method('create')->will($this->returnValue('expected-result')); $this->assertEquals('expected-result', $this->orderList->invoke($this->searchCriteriaMock)); }
/** * test order hold service */ public function testInvoke() { $this->orderRepositoryMock->expects($this->once())->method('get')->with($this->equalTo(1))->will($this->returnValue($this->orderMock)); $this->orderMock->expects($this->once())->method('hold')->will($this->returnSelf()); $this->assertTrue($this->orderHold->invoke(1)); }
public function testGetOrderNull() { $payment = $this->initPayment(); $this->orderRepository->expects($this->never())->method('get'); $this->assertNull($payment->getOrder()); }
/** * test order list service */ public function testInvoke() { $this->orderRepositoryMock->expects($this->once())->method('get')->with($this->equalTo(1))->will($this->returnValue($this->orderMock)); $this->orderMapperMock->expects($this->once())->method('extractDto')->with($this->equalTo($this->orderMock))->will($this->returnValue($this->dataObjectMock)); $this->assertEquals($this->dataObjectMock, $this->orderGet->invoke(1)); }