Also test PHP 7.2

This commit is contained in:
James Cole
2018-04-15 10:44:47 +02:00
parent ef62e31b61
commit ae273f8320
5 changed files with 21 additions and 4 deletions

View File

@@ -57,10 +57,13 @@ class TwoFactorControllerTest extends TestCase
$truePref->data = true;
$secretPreference = new Preference;
$secretPreference->data = 'JZMES376Z6YXY4QZ';
$langPreference = new Preference;
$langPreference->data = 'en_US';
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePref)->twice();
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference)->once();
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference)->once();
Preferences::shouldReceive('get')->withArgs(['language', 'en_US'])->andReturn($langPreference);
$response = $this->get(route('two-factor.index'));
$response->assertStatus(200);
@@ -75,9 +78,13 @@ class TwoFactorControllerTest extends TestCase
$falsePreference = new Preference;
$falsePreference->data = false;
$langPreference = new Preference;
$langPreference->data = 'en_US';
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(['language', 'en_US'])->andReturn($langPreference);
$response = $this->get(route('two-factor.index'));
$response->assertStatus(302);
@@ -96,9 +103,13 @@ class TwoFactorControllerTest extends TestCase
$truePref->data = true;
$secretPreference = new Preference;
$secretPreference->data = '';
$langPreference = new Preference;
$langPreference->data = 'en_US';
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePref)->twice();
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference)->once();
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference)->once();
Preferences::shouldReceive('get')->withArgs(['language', 'en_US'])->andReturn($langPreference);
$response = $this->get(route('two-factor.index'));
$response->assertStatus(500);
@@ -115,9 +126,13 @@ class TwoFactorControllerTest extends TestCase
$truePreference->data = true;
$secretPreference = new Preference;
$secretPreference->data = 'JZMES376Z6YXY4QZ';
$langPreference = new Preference;
$langPreference->data = 'en_US';
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePreference);
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference);
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference);
Preferences::shouldReceive('get')->withArgs(['language', 'en_US'])->andReturn($langPreference);
$response = $this->get(route('two-factor.lost'));
$response->assertStatus(200);