/**
  * Run test for validate method
  *
  * @param array $validationSubject
  * @param bool $isValid
  * @param Phrase[] $messages
  * @return void
  *
  * @dataProvider dataProviderTestValidate
  */
 public function testValidate(array $validationSubject, $isValid, $messages)
 {
     /** @var ResultInterface|\PHPUnit_Framework_MockObject_MockObject $resultMock */
     $resultMock = $this->getMock(ResultInterface::class);
     $this->subjectReaderMock->expects(self::once())->method('readResponseObject')->with($validationSubject)->willReturn($validationSubject['response']['object']);
     $this->resultInterfaceFactoryMock->expects(self::once())->method('create')->with(['isValid' => $isValid, 'failsDescription' => $messages])->willReturn($resultMock);
     $actualMock = $this->responseValidator->validate($validationSubject);
     self::assertEquals($resultMock, $actualMock);
 }
Пример #2
0
 /**
  * @return array
  */
 protected function getResponseValidators()
 {
     return array_merge(parent::getResponseValidators(), [function ($response) {
         return [isset($response->transaction) && in_array($response->transaction->status, [Transaction::AUTHORIZED, Transaction::SUBMITTED_FOR_SETTLEMENT, Transaction::SETTLING]), [__('Wrong transaction status')]];
     }]);
 }