Exemplo n.º 1
0
 /**
  * Executes command basing on business object
  *
  * @param array $commandSubject
  * @return void
  */
 public function execute(array $commandSubject)
 {
     // @TODO implement exceptions catching
     $transferO = $this->transferBuilder->build($this->requestBuilder->build($commandSubject));
     $response = $this->gateway->placeRequest($transferO);
     $this->responseHandler->handle($commandSubject, $response);
 }
Exemplo n.º 2
0
 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);
 }