mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-08-21 18:40:25 +02:00
Add Store icons to database feature
This commit is contained in:
@@ -5,6 +5,8 @@ namespace Tests\Unit;
|
||||
use App\Exceptions\EncryptedMigrationException;
|
||||
use App\Exceptions\InvalidMigrationDataException;
|
||||
use App\Exceptions\UnsupportedMigrationException;
|
||||
use App\Facades\Icons;
|
||||
use App\Facades\IconStore;
|
||||
use App\Factories\MigratorFactory;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Providers\MigrationServiceProvider;
|
||||
@@ -72,10 +74,12 @@ class MigratorTest extends TestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->mock(SettingService::class, function (MockInterface $settingService) {
|
||||
$settingService->allows()
|
||||
->get('useEncryption')
|
||||
->andReturn(false);
|
||||
$this->mock(SettingService::class, function (MockInterface $iconStore) {
|
||||
foreach (config('2fauth.settings') as $setting => $value) {
|
||||
$iconStore->shouldReceive('get')
|
||||
->with($setting)
|
||||
->andReturn($value);
|
||||
}
|
||||
});
|
||||
|
||||
$this->totpTwofaccount = new TwoFAccount;
|
||||
@@ -360,6 +364,7 @@ class MigratorTest extends TestCase
|
||||
#[DataProvider('AegisWithIconMigrationProvider')]
|
||||
public function test_migrate_aegis_payload_with_icon_sets_and_stores_the_icon($migration)
|
||||
{
|
||||
Icons::spy();
|
||||
Storage::fake('icons');
|
||||
|
||||
$migrator = new AegisMigrator;
|
||||
@@ -368,6 +373,7 @@ class MigratorTest extends TestCase
|
||||
$this->assertContainsOnlyInstancesOf(TwoFAccount::class, $accounts);
|
||||
$this->assertCount(1, $accounts);
|
||||
|
||||
Icons::shouldHaveReceived('buildFromResource')->once();
|
||||
Storage::disk('icons')->assertExists($accounts->first()->icon);
|
||||
}
|
||||
|
||||
@@ -408,14 +414,16 @@ class MigratorTest extends TestCase
|
||||
#[DataProvider('TwoFAuthWithIconMigrationProvider')]
|
||||
public function test_migrate_2fauth_payload_with_icon_sets_and_stores_the_icon($migration)
|
||||
{
|
||||
Icons::spy();
|
||||
Storage::fake('icons');
|
||||
|
||||
|
||||
$migrator = new TwoFAuthMigrator;
|
||||
$accounts = $migrator->migrate($migration);
|
||||
|
||||
|
||||
$this->assertContainsOnlyInstancesOf(TwoFAccount::class, $accounts);
|
||||
$this->assertCount(1, $accounts);
|
||||
|
||||
|
||||
Icons::shouldHaveReceived('buildFromResource')->once();
|
||||
Storage::disk('icons')->assertExists($accounts->first()->icon);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user