Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
IAVSResponseTest.php
Go to the documentation of this file.
1 <?php
7 
12 use PHPUnit_Framework_MockObject_MockObject as MockObject;
13 
14 class IAVSResponseTest extends \PHPUnit\Framework\TestCase
15 {
24  public function testValidate($configValue, $iavs, $expected)
25  {
26  $response = new DataObject([
27  'iavs' => $iavs
28  ]);
29 
31  $config = $this->getMockBuilder(PayflowConfig::class)
32  ->disableOriginalConstructor()
33  ->getMock();
34 
36  $model = $this->getMockBuilder(Transparent::class)
37  ->disableOriginalConstructor()
38  ->getMock();
39 
40  $model->method('getConfig')
41  ->willReturn($config);
42 
43  $config->method('getValue')
44  ->willReturn($configValue);
45 
46  $validator = new IAVSResponse();
47  self::assertEquals($expected, $validator->validate($response, $model));
48  }
49 
55  public function variationsDataProvider()
56  {
57  return [
58  ['configValue' => 1, 'iavs' => 'Y', 'expected' => false],
59  ['configValue' => 0, 'iavs' => 'Y', 'expected' => true],
60  ['configValue' => 1, 'iavs' => 'N', 'expected' => true],
61  ['configValue' => 1, 'iavs' => 'X', 'expected' => true],
62  ['configValue' => 0, 'iavs' => 'X', 'expected' => true],
63  ];
64  }
65 }
$response
Definition: 404.php:11
$config
Definition: fraud_order.php:17