Code Duplication    Length = 8-15 lines in 8 locations

Test/Unit/Helper/ConsumerscoreTest.php 1 location

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

Test/Unit/Helper/EnvironmentTest.php 3 locations

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

Test/Unit/Helper/PaymentTest.php 4 locations

@@ 106-113 (lines=8) @@
103
        $this->assertEquals($expected, $result);
104
    }
105
106
    public function testIsCheckCvcActive()
107
    {
108
        $this->scopeConfig->expects($this->any())
109
            ->method('getValue')
110
            ->willReturnMap([['payone_payment/'.PayoneConfig::METHOD_CREDITCARD.'/check_cvc', ScopeInterface::SCOPE_STORE, null, 1]]);
111
        $result = $this->payment->isCheckCvcActive();
112
        $this->assertTrue($result);
113
    }
114
115
    public function testIsMandateManagementActive()
116
    {
@@ 115-122 (lines=8) @@
112
        $this->assertTrue($result);
113
    }
114
115
    public function testIsMandateManagementActive()
116
    {
117
        $this->scopeConfig->expects($this->any())
118
            ->method('getValue')
119
            ->willReturnMap([['payone_payment/'.PayoneConfig::METHOD_DEBIT.'/sepa_mandate_enabled', ScopeInterface::SCOPE_STORE, null, 1]]);
120
        $result = $this->payment->isMandateManagementActive();
121
        $this->assertTrue($result);
122
    }
123
124
    public function testIsMandateManagementDownloadActive()
125
    {
@@ 124-131 (lines=8) @@
121
        $this->assertTrue($result);
122
    }
123
124
    public function testIsMandateManagementDownloadActive()
125
    {
126
        $this->scopeConfig->expects($this->any())
127
            ->method('getValue')
128
            ->willReturnMap([['payone_payment/'.PayoneConfig::METHOD_DEBIT.'/sepa_mandate_download_enabled', ScopeInterface::SCOPE_STORE, null, 1]]);
129
        $result = $this->payment->isMandateManagementDownloadActive();
130
        $this->assertTrue($result);
131
    }
132
133
    public function testGetStatusMappingByCode()
134
    {
@@ 159-166 (lines=8) @@
156
        $this->assertEquals($expected, $result);
157
    }
158
159
    public function testIsPayPalExpressActive()
160
    {
161
        $this->scopeConfig->expects($this->any())
162
            ->method('getValue')
163
            ->willReturnMap([['payone_payment/'.PayoneConfig::METHOD_PAYPAL.'/express_active', ScopeInterface::SCOPE_STORE, null, 1]]);
164
        $result = $this->payment->isPayPalExpressActive();
165
        $this->assertTrue($result);
166
    }
167
168
    public function testGetPaymentAbbreviation()
169
    {