36 lines
833 B
PHP
36 lines
833 B
PHP
<?php
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
$this->artisan('db:seed');
|
|
});
|
|
|
|
test('enable two factor', function () {
|
|
Setting::set('2fa.enabled', false);
|
|
|
|
$this->assertFalse(Setting::get('2fa.enabled'));
|
|
|
|
$this->actingAsAdmin()
|
|
->from('/settings/auth')
|
|
->post('/settings/auth/2fa/enable')
|
|
->assertRedirect('/settings/auth');
|
|
|
|
$this->assertTrue(Setting::get('2fa.enabled'));
|
|
});
|
|
|
|
test('disable two factor', function () {
|
|
Setting::set('2fa.enabled', true);
|
|
|
|
$this->assertTrue(Setting::get('2fa.enabled'));
|
|
|
|
$this->actingAsAdmin()
|
|
->from('/settings/auth')
|
|
->post('/settings/auth/2fa/disable')
|
|
->assertRedirect('/settings/auth');
|
|
|
|
$this->assertFalse(Setting::get('2fa.enabled'));
|
|
});
|