Code Duplication    Length = 31-31 lines in 2 locations

src/Tests/Integration/Admin/Verification/InvalidCodeTest.php 1 location

@@ 28-58 (lines=31) @@
25
use Rossmitchell\Twofactor\Tests\Integration\FixtureLoader\Traits\AdminUserLoader;
26
use Rossmitchell\Twofactor\Tests\Integration\FixtureLoader\Traits\ConfigurationLoader;
27
28
class InvalidCodeTest extends AbstractTestClass
29
{
30
    use AdminUserLoader;
31
    use ConfigurationLoader;
32
33
    public static function getAdminUserDataPath()
34
    {
35
        return __DIR__ . '/../_files/adminUser.php';
36
    }
37
38
    public static function getConfigurationDataPath()
39
    {
40
        return __DIR__.'/../_files/two_factor_enabled.php';
41
    }
42
43
    /**
44
     * @magentoDbIsolation enabled
45
     * @magentoDataFixture loadAdminUsers
46
     * @magentoDataFixture loadConfiguration
47
     */
48
    public function testInvalidCode()
49
    {
50
        $this->loginAdmin('two_factor_enabled');
51
        $this->getRequest()
52
            ->setMethod('POST')
53
            ->setParam('secret', 'invalid');
54
        $this->dispatch('/backend/twofactor/adminlogin/verify');
55
56
        $this->assertRedirect($this->stringContains('backend/twofactor/adminlogin/index'));
57
    }
58
}
59

src/Tests/Integration/Customer/Verification/InvalidCodeTest.php 1 location

@@ 28-58 (lines=31) @@
25
use Rossmitchell\Twofactor\Tests\Integration\FixtureLoader\Traits\ConfigurationLoader;
26
use Rossmitchell\Twofactor\Tests\Integration\FixtureLoader\Traits\CustomerLoader;
27
28
class InvalidCodeTest extends AbstractTestClass
29
{
30
    use CustomerLoader;
31
    use ConfigurationLoader;
32
33
    public static function getCustomerDataPath()
34
    {
35
        return __DIR__.'/../_files/customer.php';
36
    }
37
38
    public static function getConfigurationDataPath()
39
    {
40
        return __DIR__.'/../_files/two_factor_enabled.php';
41
    }
42
43
    /**
44
     * @magentoDbIsolation   enabled
45
     * @magentoDataFixture   loadCustomer
46
     * @magentoDataFixture   loadConfiguration
47
     */
48
    public function testInvalidCode()
49
    {
50
        $this->login('[email protected]');
51
        $this->getRequest()
52
            ->setMethod('POST')
53
            ->setParam('secret', 'notarealcode');
54
        $this->dispatch('/twofactor/customerlogin/verify');
55
56
        $this->assertRedirect($this->stringContains('twofactor/customerlogin/index'));
57
    }
58
}
59