Completed
Push — master ( 70bc12...725ad3 )
by Ross
35:29
created

InvalidCodeTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 32.26 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 0
cbo 3
dl 10
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getCustomerDataPath() 0 4 1
A getConfigurationDataPath() 0 4 1
A testInvalidCode() 10 10 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * A two factor authentication module that protects both the admin and customer logins
4
 * Copyright (C) 2017  Ross Mitchell
5
 *
6
 * This file is part of Rossmitchell/Twofactor.
7
 *
8
 * Rossmitchell/Twofactor is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU General Public License as published by
10
 * the Free Software Foundation, either version 3 of the License, or
11
 * (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20
 */
21
22
namespace Rossmitchell\Twofactor\Tests\Integration\Customer\Verification;
23
24
25
use Rossmitchell\Twofactor\Tests\Integration\Abstracts\AbstractTestClass;
26
use Rossmitchell\Twofactor\Tests\Integration\FixtureLoader\Traits\ConfigurationLoader;
27
use Rossmitchell\Twofactor\Tests\Integration\FixtureLoader\Traits\CustomerLoader;
28
29
class InvalidCodeTest extends AbstractTestClass
30
{
31
    use CustomerLoader;
32
    use ConfigurationLoader;
33
34
    public static function getCustomerDataPath()
35
    {
36
        return __DIR__.'/../_files/customer.php';
37
    }
38
39
    public static function getConfigurationDataPath()
40
    {
41
        return __DIR__.'/../_files/two_factor_enabled.php';
42
    }
43
44
    /**
45
     * @magentoDbIsolation   enabled
46
     * @magentoDataFixture   loadCustomer
47
     * @magentoDataFixture   loadConfiguration
48
     */
49 View Code Duplication
    public function testInvalidCode()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
50
    {
51
        $this->login('[email protected]');
52
        $this->getRequest()
53
            ->setMethod('POST')
54
            ->setParam('secret', 'notarealcode');
55
        $this->dispatch('/twofactor/customerlogin/verify');
56
57
        $this->assertRedirect($this->stringContains('twofactor/customerlogin/index'));
58
    }
59
}
60