| @@ 27-49 (lines=23) @@ | ||
| 24 | use Rossmitchell\Twofactor\Tests\Integration\Abstracts\AbstractTestClass; |
|
| 25 | use Rossmitchell\Twofactor\Tests\Integration\FixtureLoader\Traits\ConfigurationLoader; |
|
| 26 | ||
| 27 | class CanHandleNoCustomerTest extends AbstractTestClass |
|
| 28 | { |
|
| 29 | use ConfigurationLoader; |
|
| 30 | ||
| 31 | public static function getConfigurationDataPath() |
|
| 32 | { |
|
| 33 | return __DIR__.'/../_files/two_factor_enabled.php'; |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @magentoDbIsolation enabled |
|
| 38 | * @magentoDataFixture loadConfiguration |
|
| 39 | */ |
|
| 40 | public function testRedirectWhenThereIsNoCustomer() |
|
| 41 | { |
|
| 42 | $this->getRequest() |
|
| 43 | ->setMethod('POST') |
|
| 44 | ->setParam('secret', 'notarealcode'); |
|
| 45 | $this->dispatch('/twofactor/customerlogin/verify'); |
|
| 46 | ||
| 47 | $this->assertRedirect($this->stringContains('customer/account/login')); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 27-49 (lines=23) @@ | ||
| 24 | use Rossmitchell\Twofactor\Tests\Integration\Abstracts\AbstractTestClass; |
|
| 25 | use Rossmitchell\Twofactor\Tests\Integration\FixtureLoader\Traits\ConfigurationLoader; |
|
| 26 | ||
| 27 | class RedirectToHomeWhenDisabledTest extends AbstractTestClass |
|
| 28 | { |
|
| 29 | use ConfigurationLoader; |
|
| 30 | ||
| 31 | public static function getConfigurationDataPath() |
|
| 32 | { |
|
| 33 | return __DIR__.'/../_files/two_factor_disabled.php'; |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @magentoDbIsolation enabled |
|
| 38 | * @magentoDataFixture loadConfiguration |
|
| 39 | */ |
|
| 40 | public function testRedirectWhenDisabled() |
|
| 41 | { |
|
| 42 | $this->getRequest() |
|
| 43 | ->setMethod('POST') |
|
| 44 | ->setParam('secret', 'notarealcode'); |
|
| 45 | $this->dispatch('/twofactor/customerlogin/verify'); |
|
| 46 | ||
| 47 | $this->assertRedirectsToHomePage(); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 27-47 (lines=21) @@ | ||
| 24 | use Rossmitchell\Twofactor\Tests\Integration\Abstracts\AbstractTestClass; |
|
| 25 | use Rossmitchell\Twofactor\Tests\Integration\FixtureLoader\Traits\ConfigurationLoader; |
|
| 26 | ||
| 27 | class CanHandleNoUserTest extends AbstractTestClass |
|
| 28 | { |
|
| 29 | use ConfigurationLoader; |
|
| 30 | ||
| 31 | public static function getConfigurationDataPath() |
|
| 32 | { |
|
| 33 | return __DIR__.'/../_files/two_factor_enabled.php'; |
|
| 34 | } |
|
| 35 | ||
| 36 | /** |
|
| 37 | * @magentoDbIsolation enabled |
|
| 38 | * @magentoDataFixture loadConfiguration |
|
| 39 | */ |
|
| 40 | public function testNoUser() |
|
| 41 | { |
|
| 42 | $this->getRequest()->setMethod('POST')->setParam('secret', 'notarealcode'); |
|
| 43 | $this->dispatch('/backend/twofactor/adminlogin/verify'); |
|
| 44 | ||
| 45 | $this->assertRedirect($this->stringContains('admin/index/index')); |
|
| 46 | } |
|
| 47 | } |
|
| 48 | ||