Definition at line 12 of file InfoTest.php.
◆ additionalInformationDataProvider()
additionalInformationDataProvider |
( |
| ) |
|
Prepared data for testSetAdditionalInformationMultipleTypes
- Returns
- array
Definition at line 198 of file InfoTest.php.
201 [[
'key1' =>
'data1',
'key2' =>
'data2'],
null],
◆ ccKeysDataProvider()
Returns array of Cc keys which needs prepare logic
- Returns
- array
Definition at line 79 of file InfoTest.php.
82 [
'cc_number',
'cc_number_enc'],
83 [
'cc_cid',
'cc_cid_enc']
◆ setUp()
Definition at line 35 of file InfoTest.php.
37 $this->contextMock = $this->createMock(\
Magento\Framework\Model\Context::class);
38 $this->registryMock = $this->createMock(\
Magento\Framework\Registry::class);
39 $this->paymentHelperMock = $this->createPartialMock(\
Magento\Payment\Helper\Data::class, [
'getMethodInstance']);
40 $this->encryptorInterfaceMock = $this->createMock(\
Magento\Framework\Encryption\EncryptorInterface::class);
41 $this->methodInstanceMock = $this->getMockBuilder(\
Magento\Payment\Model\MethodInterface::class)
42 ->getMockForAbstractClass();
44 $this->objectManagerHelper =
new ObjectManagerHelper($this);
45 $this->info = $this->objectManagerHelper->getObject(
46 \
Magento\Payment\Model\Info::class,
48 'context' => $this->contextMock,
49 'registry' => $this->registryMock,
50 'paymentData' => $this->paymentHelperMock,
51 'encryptor' => $this->encryptorInterfaceMock
◆ testDecrypt()
Definition at line 163 of file InfoTest.php.
166 $encryptedData =
'd1a2t3a4';
168 $this->encryptorInterfaceMock->expects($this->once())->method(
'decrypt')->with($encryptedData)->will(
169 $this->returnValue(
$data)
171 $this->assertEquals(
$data, $this->info->decrypt($encryptedData));
◆ testEncrypt()
Definition at line 152 of file InfoTest.php.
155 $encryptedData =
'd1a2t3a4';
157 $this->encryptorInterfaceMock->expects($this->once())->method(
'encrypt')->with(
$data)->will(
158 $this->returnValue($encryptedData)
160 $this->assertEquals($encryptedData, $this->info->encrypt(
$data));
◆ testGetAdditionalInformationByKey()
testGetAdditionalInformationByKey |
( |
| ) |
|
Definition at line 206 of file InfoTest.php.
210 $this->info->setAdditionalInformation($key,
$value);
211 $this->assertEquals(
$value, $this->info->getAdditionalInformation($key));
◆ testGetDataCcNumber()
testGetDataCcNumber |
( |
|
$keyCc, |
|
|
|
$keyCcEnc |
|
) |
| |
@dataProvider ccKeysDataProvider
- Parameters
-
string | $keyCc | |
string | $keyCcEnc | |
Definition at line 61 of file InfoTest.php.
64 $this->assertNull($this->info->getData($keyCc));
67 $this->info->setData($keyCcEnc, $keyCcEnc);
68 $this->encryptorInterfaceMock->expects($this->once())->method(
'decrypt')->with($keyCcEnc)->will(
69 $this->returnValue($keyCc)
71 $this->assertEquals($keyCc, $this->info->getData($keyCc));
◆ testGetMethodInstanceRequestedMethod()
testGetMethodInstanceRequestedMethod |
( |
| ) |
|
Definition at line 136 of file InfoTest.php.
138 $code =
'real_method';
139 $this->info->setData(
'method',
$code);
141 $this->paymentHelperMock->expects($this->once())->method(
'getMethodInstance')->with(
$code)->will(
142 $this->returnValue($this->methodInstanceMock)
145 $this->methodInstanceMock->expects($this->once())->method(
'setInfoInstance')->with($this->info);
146 $this->assertSame($this->methodInstanceMock, $this->info->getMethodInstance());
149 $this->assertSame($this->methodInstanceMock, $this->info->getMethodInstance());
◆ testGetMethodInstanceWithNoMethod()
testGetMethodInstanceWithNoMethod |
( |
| ) |
|
@expectedException \Magento\Framework\Exception\LocalizedException @expectedExceptionMessage The payment method you requested is not available.
Definition at line 130 of file InfoTest.php.
132 $this->info->setData(
'method',
false);
133 $this->info->getMethodInstance();
◆ testGetMethodInstanceWithRealMethod()
testGetMethodInstanceWithRealMethod |
( |
| ) |
|
Definition at line 87 of file InfoTest.php.
90 $this->info->setData(
'method',
$method);
92 $this->methodInstanceMock->expects($this->once())
93 ->method(
'setInfoInstance')
96 $this->paymentHelperMock->expects($this->once())
97 ->method(
'getMethodInstance')
99 ->willReturn($this->methodInstanceMock);
101 $this->info->getMethodInstance();
◆ testGetMethodInstanceWithUnrealMethod()
testGetMethodInstanceWithUnrealMethod |
( |
| ) |
|
Definition at line 104 of file InfoTest.php.
107 $this->info->setData(
'method',
$method);
109 $this->paymentHelperMock->expects($this->at(0))
110 ->method(
'getMethodInstance')
112 ->willThrowException(
new \UnexpectedValueException());
114 $this->methodInstanceMock->expects($this->once())
115 ->method(
'setInfoInstance')
118 $this->paymentHelperMock->expects($this->at(1))
119 ->method(
'getMethodInstance')
121 ->willReturn($this->methodInstanceMock);
123 $this->info->getMethodInstance();
◆ testHasAdditionalInformation()
testHasAdditionalInformation |
( |
| ) |
|
Definition at line 230 of file InfoTest.php.
232 $this->assertFalse($this->info->hasAdditionalInformation());
234 $data = [
'key1' =>
'data1',
'key2' =>
'data2'];
235 $this->info->setAdditionalInformation(
$data);
236 $this->assertFalse($this->info->hasAdditionalInformation(
'key3'));
238 $this->assertTrue($this->info->hasAdditionalInformation(
'key2'));
239 $this->assertTrue($this->info->hasAdditionalInformation());
◆ testInitAdditionalInformationWithUnserialize()
testInitAdditionalInformationWithUnserialize |
( |
| ) |
|
Definition at line 242 of file InfoTest.php.
244 $data = [
'key1' =>
'data1',
'key2' =>
'data2'];
245 $this->info->setData(
'additional_information',
$data);
247 $this->assertEquals(
$data, $this->info->getAdditionalInformation());
◆ testSetAdditionalInformationException()
testSetAdditionalInformationException |
( |
| ) |
|
@expectedException \Magento\Framework\Exception\LocalizedException
Definition at line 177 of file InfoTest.php.
179 $this->info->setAdditionalInformation(
'object',
new \StdClass());
◆ testSetAdditionalInformationMultipleTypes()
testSetAdditionalInformationMultipleTypes |
( |
|
$key, |
|
|
|
$value = null |
|
) |
| |
@dataProvider additionalInformationDataProvider
- Parameters
-
Definition at line 187 of file InfoTest.php.
189 $this->info->setAdditionalInformation($key,
$value);
190 $this->assertEquals(
$value ? [$key =>
$value] : $key, $this->info->getAdditionalInformation());
◆ testUnsAdditionalInformation()
testUnsAdditionalInformation |
( |
| ) |
|
Definition at line 214 of file InfoTest.php.
217 $data = [
'key1' =>
'data1',
'key2' =>
'data2'];
218 $this->info->setAdditionalInformation(
$data);
223 $this->info->unsAdditionalInformation(
'key1')->getAdditionalInformation()
227 $this->assertEmpty($this->info->unsAdditionalInformation()->getAdditionalInformation());
◆ $contextMock
◆ $encryptorInterfaceMock
◆ $info
◆ $methodInstanceMock
◆ $objectManagerHelper
◆ $paymentHelperMock
◆ $registryMock
The documentation for this class was generated from the following file: