-
Notifications
You must be signed in to change notification settings - Fork 213
/
Copy pathDataPatchTest.php
53 lines (45 loc) · 1.61 KB
/
DataPatchTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
/**
*
* Adyen Payment module (https://www.adyen.com/)
*
* Copyright (c) 2023 Adyen N.V. (https://www.adyen.com/)
* See LICENSE.txt for license details.
*
* Author: Adyen <magento@adyen.com>
*/
namespace Adyen\Payment\Test\Unit\Helper;
use Adyen\Payment\Helper\DataPatch;
use Adyen\Payment\Test\Unit\AbstractAdyenTestCase;
use Magento\Framework\DB\Select;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\DB\Adapter\AdapterInterface;
class DataPatchTest extends AbstractAdyenTestCase
{
const TEST_CONFIG_PATH = 'payment/adyen_mock_payment_method/sort_order';
const CONFIG_VALUE = '10';
public function testFindConfig()
{
$connectionMock = $this->createConfiguredMock(AdapterInterface::class, [
'fetchAll' => [
[
'config_id' => 1,
'scope' => 'default',
'scope_id' => 0,
'path' => self::TEST_CONFIG_PATH,
'value' => self::CONFIG_VALUE,
'updated_at' => '2023-10-11 11:05:11'
]
],
'select' => $this->createConfiguredMock(Select::class, [
'from' => $this->createMock(Select::class)
])
]);
$setupMock = $this->createConfiguredMock(ModuleDataSetupInterface::class, [
'getConnection' => $connectionMock
]);
$dataPatchHelper = new DataPatch();
$config = $dataPatchHelper->findConfig($setupMock, self::TEST_CONFIG_PATH, self::CONFIG_VALUE);
$this->assertEquals(self::CONFIG_VALUE, $config['value']);
}
}