Update & Complete API controllers tests and Unit tests

This commit is contained in:
Bubka
2023-03-08 17:43:26 +01:00
parent 823acde49d
commit 0a8807d87a
18 changed files with 545 additions and 99 deletions

View File

@ -7,6 +7,8 @@ use App\Exceptions\InvalidMigrationDataException;
use App\Exceptions\UnsupportedMigrationException;
use App\Factories\MigratorFactory;
use App\Models\TwoFAccount;
use App\Models\User;
use App\Services\LogoService;
use App\Services\Migrators\AegisMigrator;
use App\Services\Migrators\GoogleAuthMigrator;
use App\Services\Migrators\Migrator;
@ -57,7 +59,7 @@ class MigratorTest extends TestCase
/**
* App\Models\TwoFAccount $GAuthTotpBisTwofaccount
*/
protected $GAuthTotpBisTwofaccount;
protected $GAuthTotpBisTwofaccount, $fakeTwofaccount;
public function setUp() : void
{
@ -67,12 +69,15 @@ class MigratorTest extends TestCase
$settingService->allows()
->get('useEncryption')
->andReturn(false);
$settingService->allows()
->get('getOfficialIcons')
->andReturn(false);
});
$this->mock(LogoService::class, function (MockInterface $logoService) {
$logoService->allows([
'getIcon' => null,
]);
});
$this->totpTwofaccount = new TwoFAccount;
$this->totpTwofaccount->legacy_uri = OtpTestData::TOTP_FULL_CUSTOM_URI_NO_IMG;
$this->totpTwofaccount->service = OtpTestData::SERVICE;