Code cleanup and tests.

This commit is contained in:
James Cole
2017-07-23 08:32:51 +02:00
parent 8bb7d5de3f
commit f85ab74e2b
15 changed files with 72 additions and 90 deletions

View File

@@ -41,10 +41,6 @@ class TwoFactorControllerTest extends TestCase
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference)->once();
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference)->once();
$falsePref = new Preference;
$falsePref->data = false;
Preferences::shouldReceive('get')->withArgs(['shown_demo_two-factor.index', false])->andReturn($falsePref)->once();
$response = $this->get(route('two-factor.index'));
$response->assertStatus(200);
}
@@ -61,7 +57,6 @@ class TwoFactorControllerTest extends TestCase
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($falsePreference)->twice();
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn(null)->once();
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn(null)->once();
Preferences::shouldReceive('get')->withArgs(['shown_demo_two-factor.index', false])->andReturn($falsePreference)->once();
$response = $this->get(route('two-factor.index'));
$response->assertStatus(302);
@@ -84,10 +79,6 @@ class TwoFactorControllerTest extends TestCase
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference)->once();
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference)->once();
$falsePref = new Preference;
$falsePref->data = false;
Preferences::shouldReceive('get')->withArgs(['shown_demo_two-factor.index', false])->andReturn($falsePref)->once();
$response = $this->get(route('two-factor.index'));
$response->assertStatus(500);
}
@@ -107,10 +98,6 @@ class TwoFactorControllerTest extends TestCase
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference);
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference);
$falsePref = new Preference;
$falsePref->data = false;
Preferences::shouldReceive('get')->withArgs(['shown_demo_two-factor.lost', false])->andReturn($falsePref)->once();
$response = $this->get(route('two-factor.lost'));
$response->assertStatus(200);
}