mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix all tests after large composer update.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Tests\Feature\Controllers;
|
||||
namespace Tests\Feature\Controllers\Admin;
|
||||
|
||||
use FireflyIII\Models\LinkType;
|
||||
use Tests\TestCase;
|
||||
|
@@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||
namespace Tests\Feature\Controllers\Auth;
|
||||
|
||||
use FireflyIII\Models\Preference;
|
||||
use PragmaRX\Google2FA\Contracts\Google2FA;
|
||||
use Google2FA;
|
||||
use Preferences;
|
||||
use Tests\TestCase;
|
||||
|
||||
@@ -46,7 +46,7 @@ class TwoFactorControllerTest extends TestCase
|
||||
$truePref = new Preference;
|
||||
$truePref->data = true;
|
||||
$secretPreference = new Preference;
|
||||
$secretPreference->data = 'BlablaSeecret';
|
||||
$secretPreference->data = 'JZMES376Z6YXY4QZ';
|
||||
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePref)->twice();
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference)->once();
|
||||
@@ -104,7 +104,7 @@ class TwoFactorControllerTest extends TestCase
|
||||
$truePreference = new Preference;
|
||||
$truePreference->data = true;
|
||||
$secretPreference = new Preference;
|
||||
$secretPreference->data = 'BlablaSeecret';
|
||||
$secretPreference->data = 'JZMES376Z6YXY4QZ';
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthEnabled', false])->andReturn($truePreference);
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret', null])->andReturn($secretPreference);
|
||||
Preferences::shouldReceive('get')->withArgs(['twoFactorAuthSecret'])->andReturn($secretPreference);
|
||||
@@ -119,8 +119,7 @@ class TwoFactorControllerTest extends TestCase
|
||||
public function testPostIndex()
|
||||
{
|
||||
$data = ['code' => '123456'];
|
||||
$google = $this->mock(Google2FA::class);
|
||||
$google->shouldReceive('verifyKey')->andReturn(true)->once();
|
||||
Google2FA::shouldReceive('verifyKey')->andReturn(true)->once();
|
||||
$this->session(['remember_login' => true]);
|
||||
|
||||
$this->be($this->user());
|
||||
|
@@ -28,9 +28,9 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use Illuminate\Support\Collection;
|
||||
use PragmaRX\Google2FA\Contracts\Google2FA;
|
||||
use Preferences;
|
||||
use Tests\TestCase;
|
||||
use Google2FA;
|
||||
|
||||
/**
|
||||
* Class PreferencesControllerTest
|
||||
@@ -49,10 +49,9 @@ class PreferencesControllerTest extends TestCase
|
||||
{
|
||||
// mock stuff
|
||||
$journalRepos = $this->mock(JournalRepositoryInterface::class);
|
||||
$google = $this->mock(Google2FA::class);
|
||||
$journalRepos->shouldReceive('first')->once()->andReturn(new TransactionJournal);
|
||||
$google->shouldReceive('generateSecretKey')->andReturn('secret');
|
||||
$google->shouldReceive('getQRCodeInline')->andReturn('long-data-url');
|
||||
Google2FA::shouldReceive('generateSecretKey')->andReturn('secret');
|
||||
Google2FA::shouldReceive('getQRCodeInline')->andReturn('long-data-url');
|
||||
|
||||
$this->be($this->user());
|
||||
$response = $this->get(route('preferences.code'));
|
||||
@@ -102,7 +101,6 @@ class PreferencesControllerTest extends TestCase
|
||||
{
|
||||
$secret = '0123456789abcde';
|
||||
$key = '123456';
|
||||
$google = $this->mock(Google2FA::class);
|
||||
|
||||
$this->withoutMiddleware();
|
||||
$this->session(['two-factor-secret' => $secret]);
|
||||
@@ -111,7 +109,7 @@ class PreferencesControllerTest extends TestCase
|
||||
Preferences::shouldReceive('set')->withArgs(['twoFactorAuthSecret', $secret])->once();
|
||||
Preferences::shouldReceive('mark')->once();
|
||||
|
||||
$google->shouldReceive('verifyKey')->withArgs([$secret, $key])->andReturn(true);
|
||||
Google2FA::shouldReceive('verifyKey')->withArgs([$secret, $key])->andReturn(true);
|
||||
|
||||
$data = [
|
||||
'code' => $key,
|
||||
|
Reference in New Issue
Block a user