Code Duplication    Length = 8-15 lines in 8 locations

Test/Unit/Helper/ConsumerscoreTest.php 1 location

@@ 284-295 (lines=12) @@
281
        $this->assertFalse($result);
282
    }
283
284
    public function testIsCreditratingNeededNotEnabled()
285
    {
286
        $this->scopeConfig->expects($this->any())
287
            ->method('getValue')
288
            ->willReturnMap(
289
                [
290
                    ['payone_protect/creditrating/enabled', ScopeInterface::SCOPE_STORE, null, 0]
291
                ]
292
            );
293
        $result = $this->consumerscore->isCreditratingNeeded('after_payment', 500);
294
        $this->assertFalse($result);
295
    }
296
297
    public function testIsCreditratingNeededWrongEvent()
298
    {

Test/Unit/Helper/EnvironmentTest.php 3 locations

@@ 92-106 (lines=15) @@
89
        $this->assertEquals($expected, $result);
90
    }
91
92
    public function testIsRemoteIpValid()
93
    {
94
        $sWhitelist = "127.0.0.1\n166.7.1.*\n192.168.*.*\n217.8.19.7";
95
96
        $this->scopeConfig->expects($this->any())
97
            ->method('getValue')
98
            ->willReturnMap(
99
                [
100
                    ['payone_misc/processing/valid_ips', ScopeInterface::SCOPE_STORE, null, $sWhitelist]
101
                ]
102
            );
103
104
        $result = $this->environment->isRemoteIpValid();
105
        $this->assertTrue($result);
106
    }
107
108
    public function testIsRemoteIpNotValid()
109
    {
@@ 108-122 (lines=15) @@
105
        $this->assertTrue($result);
106
    }
107
108
    public function testIsRemoteIpNotValid()
109
    {
110
        $sWhitelist = "127.0.0.1\n166.7.1.*\n217.8.19.7";
111
112
        $this->scopeConfig->expects($this->any())
113
            ->method('getValue')
114
            ->willReturnMap(
115
                [
116
                    ['payone_misc/processing/valid_ips', ScopeInterface::SCOPE_STORE, null, $sWhitelist]
117
                ]
118
            );
119
120
        $result = $this->environment->isRemoteIpValid();
121
        $this->assertFalse($result);
122
    }
123
124
    public function testIsRemoteIpDirectValid()
125
    {
@@ 124-138 (lines=15) @@
121
        $this->assertFalse($result);
122
    }
123
124
    public function testIsRemoteIpDirectValid()
125
    {
126
        $sWhitelist = "127.0.0.1\n166.7.1.*\n217.8.19.7\n192.168.1.100";
127
128
        $this->scopeConfig->expects($this->any())
129
            ->method('getValue')
130
            ->willReturnMap(
131
                [
132
                    ['payone_misc/processing/valid_ips', ScopeInterface::SCOPE_STORE, null, $sWhitelist]
133
                ]
134
            );
135
136
        $result = $this->environment->isRemoteIpValid();
137
        $this->assertTrue($result);
138
    }
139
}
140

Test/Unit/Helper/PaymentTest.php 4 locations

@@ 95-102 (lines=8) @@
92
        $this->assertEquals($expected, $result);
93
    }
94
95
    public function testIsCheckCvcActive()
96
    {
97
        $this->scopeConfig->expects($this->any())
98
            ->method('getValue')
99
            ->willReturnMap([['payone_payment/'.PayoneConfig::METHOD_CREDITCARD.'/check_cvc', ScopeInterface::SCOPE_STORE, null, 1]]);
100
        $result = $this->payment->isCheckCvcActive();
101
        $this->assertTrue($result);
102
    }
103
104
    public function testIsMandateManagementActive()
105
    {
@@ 104-111 (lines=8) @@
101
        $this->assertTrue($result);
102
    }
103
104
    public function testIsMandateManagementActive()
105
    {
106
        $this->scopeConfig->expects($this->any())
107
            ->method('getValue')
108
            ->willReturnMap([['payone_payment/'.PayoneConfig::METHOD_DEBIT.'/sepa_mandate_enabled', ScopeInterface::SCOPE_STORE, null, 1]]);
109
        $result = $this->payment->isMandateManagementActive();
110
        $this->assertTrue($result);
111
    }
112
113
    public function testIsMandateManagementDownloadActive()
114
    {
@@ 113-120 (lines=8) @@
110
        $this->assertTrue($result);
111
    }
112
113
    public function testIsMandateManagementDownloadActive()
114
    {
115
        $this->scopeConfig->expects($this->any())
116
            ->method('getValue')
117
            ->willReturnMap([['payone_payment/'.PayoneConfig::METHOD_DEBIT.'/sepa_mandate_download_enabled', ScopeInterface::SCOPE_STORE, null, 1]]);
118
        $result = $this->payment->isMandateManagementDownloadActive();
119
        $this->assertTrue($result);
120
    }
121
122
    public function testGetStatusMappingByCode()
123
    {
@@ 148-155 (lines=8) @@
145
        $this->assertEquals($expected, $result);
146
    }
147
148
    public function testIsPayPalExpressActive()
149
    {
150
        $this->scopeConfig->expects($this->any())
151
            ->method('getValue')
152
            ->willReturnMap([['payone_payment/'.PayoneConfig::METHOD_PAYPAL.'/express_active', ScopeInterface::SCOPE_STORE, null, 1]]);
153
        $result = $this->payment->isPayPalExpressActive();
154
        $this->assertTrue($result);
155
    }
156
157
    public function testGetPaymentAbbreviation()
158
    {