/**
  * @dataProvider validateAllowspecificFalseDataProvider
  */
 public function testValidateAllowspecificFalse($storeId, $allowspecific, $isValid)
 {
     $validationSubject = ['storeId' => $storeId];
     $this->configMock->expects($this->at(0))->method('getValue')->with('allowspecific', $storeId)->willReturn($allowspecific);
     $this->resultFactoryMock->expects($this->once())->method('create')->with(['isValid' => $isValid])->willReturn($this->resultMock);
     $this->assertSame($this->resultMock, $this->model->validate($validationSubject));
 }
 /**
  * Run test for validate method
  *
  * @param array $validationSubject
  * @param bool $isValid
  * @return void
  *
  * @dataProvider dataProviderTestValidate
  */
 public function testValidate(array $validationSubject, $isValid)
 {
     /** @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' => ['Transaction has been declined, please, try again later.']])->willReturn($resultMock);
     $actualMock = $this->responseValidator->validate($validationSubject);
     self::assertEquals($resultMock, $actualMock);
 }
 public function testValidateSuccess()
 {
     $obj = new \stdClass();
     $obj->success = true;
     $obj->paymentMethodNonce = new \stdClass();
     $obj->paymentMethodNonce->nonce = 'fj2hd9239kd1kq9';
     $subject = ['response' => ['object' => $obj]];
     $this->subjectReader->expects(static::once())->method('readResponseObject')->willReturn($obj);
     $result = $this->getMock(ResultInterface::class);
     $this->resultInterfaceFactory->expects(self::once())->method('create')->with(['isValid' => true, 'failsDescription' => []])->willReturn($result);
     $actual = $this->validator->validate($subject);
     static::assertEquals($result, $actual);
 }
 /**
  * @param array $response
  * @param array $expectationToResultCreation
  *
  * @dataProvider validateDataProvider
  */
 public function testValidate(array $response, array $expectationToResultCreation)
 {
     $this->resultFactory->expects(static::once())->method('create')->with($expectationToResultCreation)->willReturn($this->resultMock);
     $validator = new ResponseCodeValidator($this->resultFactory);
     static::assertInstanceOf(ResultInterface::class, $validator->validate(['response' => $response]));
 }