Code Duplication    Length = 12-15 lines in 3 locations

Test/Unit/Helper/ConfigExportTest.php 1 location

@@ 189-203 (lines=15) @@
186
        $this->assertEquals($expected, $result);
187
    }
188
189
    public function testGetMappings()
190
    {
191
        $config = ['random' => ['txaction' => 'appointed', 'state_status' => 'processing']];
192
        $this->scopeConfig->expects($this->any())
193
            ->method('getValue')
194
            ->willReturnMap(
195
                [
196
                    ['payone_general/statusmapping/payone_creditcard', ScopeInterface::SCOPE_STORE, null, $this->toolkitHelper->serialize($config)]
197
                ]
198
            );
199
200
        $result = $this->configExport->getMappings(null);
201
        $expected = ['cc' => [['from' => 'appointed', 'to' => 'processing']]];
202
        $this->assertEquals($result, $expected);
203
    }
204
}
205

Test/Unit/Helper/PaymentTest.php 2 locations

@@ 91-104 (lines=14) @@
88
        $this->assertContains(PayoneConfig::METHOD_CREDITCARD, $result);
89
    }
90
91
    public function testGetAvailableCreditcardTypes()
92
    {
93
        $creditcardTypes = 'V,M';
94
        $expected = [
95
            ['id' => 'V', 'title' => 'Visa'],
96
            ['id' => 'M', 'title' => 'Mastercard']
97
        ];
98
        $this->scopeConfig->expects($this->any())
99
            ->method('getValue')
100
            ->willReturnMap([['payone_payment/'.PayoneConfig::METHOD_CREDITCARD.'/types', ScopeInterface::SCOPE_STORE, null, $creditcardTypes]]);
101
102
        $result = $this->payment->getAvailableCreditcardTypes();
103
        $this->assertEquals($expected, $result);
104
    }
105
106
    public function testIsCheckCvcActive()
107
    {
@@ 179-190 (lines=12) @@
176
        $this->assertEquals($expected, $result);
177
    }
178
179
    public function testGetKlarnaStoreIds()
180
    {
181
        $storeIds = ['key' => ['store_id' => '123', 'countries' => ['DE', 'AT']]];
182
183
        $this->scopeConfig->expects($this->any())
184
            ->method('getValue')
185
            ->willReturnMap([['payone_payment/'.PayoneConfig::METHOD_KLARNA.'/klarna_config', ScopeInterface::SCOPE_STORE, null, $this->toolkitHelper->serialize($storeIds)]]);
186
187
        $expected = ['DE' => '123', 'AT' => '123'];
188
        $result = $this->payment->getKlarnaStoreIds();
189
        $this->assertEquals($expected, $result);
190
    }
191
}
192