public function testExecute() { $commandSubject = ['authorize']; $request = ['request_field1' => 'request_value1', 'request_field2' => 'request_value2']; $response = ['response_field1' => 'response_value1']; $transferO = $this->getMockBuilder('Magento\\Payment\\Gateway\\Http\\TransferInterface')->getMockForAbstractClass(); $this->requestBuilderMock->expects($this->once())->method('build')->with($commandSubject)->willReturn($request); $this->transferBuilderMock->expects($this->once())->method('build')->with($request)->willReturn($transferO); $this->gatewayMock->expects($this->once())->method('placeRequest')->with($transferO)->willReturn($response); $this->responseHandlerMock->expects($this->once())->method('handle')->with($commandSubject, $response); $this->model->execute($commandSubject); }