mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-02 11:39:19 +01:00
Update tests to phpunit 10
This commit is contained in:
parent
fe5d807170
commit
36188f2230
@ -1,24 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
backupStaticProperties="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
displayDetailsOnTestsThatTriggerErrors="true"
|
||||
displayDetailsOnTestsThatTriggerNotices="true"
|
||||
displayDetailsOnTestsThatTriggerWarnings="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
stopOnError="false"
|
||||
beStrictAboutTestsThatDoNotTestAnything="false"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage processUncoveredFiles="true">
|
||||
<source>
|
||||
<include>
|
||||
<directory suffix=".php">app</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<directory suffix=".php">app/Protobuf</directory>
|
||||
</exclude>
|
||||
</source>
|
||||
<coverage includeUncoveredFiles="true">
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
|
12
phpunit.xml
12
phpunit.xml
@ -1,24 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
backupStaticProperties="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
displayDetailsOnTestsThatTriggerErrors="true"
|
||||
displayDetailsOnTestsThatTriggerNotices="true"
|
||||
displayDetailsOnTestsThatTriggerWarnings="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
stopOnError="false"
|
||||
beStrictAboutTestsThatDoNotTestAnything="false"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
|
||||
<coverage processUncoveredFiles="true">
|
||||
<source>
|
||||
<include>
|
||||
<directory suffix=".php">app</directory>
|
||||
</include>
|
||||
<exclude>
|
||||
<directory suffix=".php">app/Protobuf</directory>
|
||||
</exclude>
|
||||
</source>
|
||||
<coverage includeUncoveredFiles="true">
|
||||
</coverage>
|
||||
<testsuites>
|
||||
<testsuite name="Unit">
|
||||
|
@ -2,13 +2,17 @@
|
||||
|
||||
namespace Tests\Api\v1\Controllers\Auth;
|
||||
|
||||
use App\Api\v1\Controllers\UserController;
|
||||
use App\Api\v1\Resources\UserResource;
|
||||
use App\Models\User;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Controllers\UserController
|
||||
* @covers \App\Api\v1\Resources\UserResource
|
||||
* UserControllerTest test class
|
||||
*/
|
||||
#[CoversClass(UserController::class)]
|
||||
#[CoversClass(UserResource::class)]
|
||||
class UserControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,18 +2,21 @@
|
||||
|
||||
namespace Tests\Api\v1\Controllers;
|
||||
|
||||
use App\Api\v1\Controllers\GroupController;
|
||||
use App\Api\v1\Resources\GroupResource;
|
||||
use App\Listeners\ResetUsersPreference;
|
||||
use App\Models\Group;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Models\User;
|
||||
use App\Policies\GroupPolicy;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Controllers\GroupController
|
||||
* @covers \App\Api\v1\Resources\GroupResource
|
||||
* @covers \App\Listeners\ResetUsersPreference
|
||||
* @covers \App\Policies\GroupPolicy
|
||||
* @covers \App\Models\Group
|
||||
*/
|
||||
#[CoversClass(GroupController::class)]
|
||||
#[CoversClass(GroupResource::class)]
|
||||
#[CoversClass(ResetUsersPreference::class)]
|
||||
#[CoversClass(GroupPolicy::class)]
|
||||
#[CoversClass(Group::class)]
|
||||
class GroupControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,14 +2,17 @@
|
||||
|
||||
namespace Tests\Api\v1\Controllers;
|
||||
|
||||
use App\Api\v1\Controllers\IconController;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Controllers\IconController
|
||||
* IconController test class
|
||||
*/
|
||||
#[CoversClass(IconController::class)]
|
||||
class IconControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,14 +2,17 @@
|
||||
|
||||
namespace Tests\Api\v1\Controllers;
|
||||
|
||||
use App\Api\v1\Controllers\QrCodeController;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Models\User;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\Classes\LocalFile;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Controllers\QrCodeController
|
||||
* QrCodeController test class
|
||||
*/
|
||||
#[CoversClass(QrCodeController::class)]
|
||||
class QrCodeControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,13 +2,16 @@
|
||||
|
||||
namespace Tests\Api\v1\Controllers;
|
||||
|
||||
use App\Api\v1\Controllers\SettingController;
|
||||
use App\Facades\Settings;
|
||||
use App\Models\User;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Controllers\SettingController
|
||||
* SettingController test class
|
||||
*/
|
||||
#[CoversClass(SettingController::class)]
|
||||
class SettingControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,28 +2,40 @@
|
||||
|
||||
namespace Tests\Api\v1\Controllers;
|
||||
|
||||
use App\Api\v1\Controllers\TwoFAccountController;
|
||||
use App\Api\v1\Resources\TwoFAccountCollection;
|
||||
use App\Api\v1\Resources\TwoFAccountExportCollection;
|
||||
use App\Api\v1\Resources\TwoFAccountExportResource;
|
||||
use App\Api\v1\Resources\TwoFAccountReadResource;
|
||||
use App\Api\v1\Resources\TwoFAccountStoreResource;
|
||||
use App\Facades\Settings;
|
||||
use App\Models\Group;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Models\User;
|
||||
use App\Policies\TwoFAccountPolicy;
|
||||
use App\Providers\MigrationServiceProvider;
|
||||
use App\Providers\TwoFAuthServiceProvider;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\Classes\LocalFile;
|
||||
use Tests\Data\MigrationTestData;
|
||||
use Tests\Data\OtpTestData;
|
||||
use Tests\FeatureTestCase;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Controllers\TwoFAccountController
|
||||
* @covers \App\Api\v1\Resources\TwoFAccountCollection
|
||||
* @covers \App\Api\v1\Resources\TwoFAccountReadResource
|
||||
* @covers \App\Api\v1\Resources\TwoFAccountStoreResource
|
||||
* @covers \App\Api\v1\Resources\TwoFAccountExportResource
|
||||
* @covers \App\Api\v1\Resources\TwoFAccountExportCollection
|
||||
* @covers \App\Providers\MigrationServiceProvider
|
||||
* @covers \App\Providers\TwoFAuthServiceProvider
|
||||
* @covers \App\Policies\TwoFAccountPolicy
|
||||
* TwoFAccountControllerTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccountController::class)]
|
||||
#[CoversClass(TwoFAccountCollection::class)]
|
||||
#[CoversClass(TwoFAccountReadResource::class)]
|
||||
#[CoversClass(TwoFAccountStoreResource::class)]
|
||||
#[CoversClass(TwoFAccountExportResource::class)]
|
||||
#[CoversClass(TwoFAccountExportCollection::class)]
|
||||
#[CoversClass(MigrationServiceProvider::class)]
|
||||
#[CoversClass(TwoFAuthServiceProvider::class)]
|
||||
#[CoversClass(TwoFAccountPolicy::class)]
|
||||
class TwoFAccountControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
@ -198,9 +210,8 @@ public function setUp() : void
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider indexUrlParameterProvider
|
||||
*/
|
||||
#[DataProvider('indexUrlParameterProvider')]
|
||||
public function test_index_returns_user_twofaccounts_only($urlParameter, $expected)
|
||||
{
|
||||
$response = $this->actingAs($this->user, 'api-guard')
|
||||
@ -227,7 +238,7 @@ public function test_index_returns_user_twofaccounts_only($urlParameter, $expect
|
||||
/**
|
||||
* Provide data for index tests
|
||||
*/
|
||||
public function indexUrlParameterProvider()
|
||||
public static function indexUrlParameterProvider()
|
||||
{
|
||||
return [
|
||||
'VALID_RESOURCE_STRUCTURE_WITHOUT_SECRET' => [
|
||||
@ -315,10 +326,9 @@ public function test_show_twofaccount_of_another_user_is_forbidden()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider accountCreationProvider
|
||||
*
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('accountCreationProvider')]
|
||||
public function test_store_without_encryption_returns_success_with_consistent_resource_structure($payload, $expected)
|
||||
{
|
||||
Settings::set('useEncryption', false);
|
||||
@ -332,10 +342,9 @@ public function test_store_without_encryption_returns_success_with_consistent_re
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider accountCreationProvider
|
||||
*
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('accountCreationProvider')]
|
||||
public function test_store_with_encryption_returns_success_with_consistent_resource_structure($payload, $expected)
|
||||
{
|
||||
Settings::set('useEncryption', true);
|
||||
@ -351,7 +360,7 @@ public function test_store_with_encryption_returns_success_with_consistent_resou
|
||||
/**
|
||||
* Provide data for TwoFAccount store tests
|
||||
*/
|
||||
public function accountCreationProvider()
|
||||
public static function accountCreationProvider()
|
||||
{
|
||||
return [
|
||||
'TOTP_FULL_CUSTOM_URI' => [
|
||||
@ -747,9 +756,8 @@ public function test_migrate_valid_aegis_json_file_returns_success()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider invalidAegisJsonFileProvider
|
||||
*/
|
||||
#[DataProvider('invalidAegisJsonFileProvider')]
|
||||
public function test_migrate_invalid_aegis_json_file_returns_bad_request($file)
|
||||
{
|
||||
$response = $this->withHeaders(['Content-Type' => 'multipart/form-data'])
|
||||
@ -763,7 +771,7 @@ public function test_migrate_invalid_aegis_json_file_returns_bad_request($file)
|
||||
/**
|
||||
* Provide invalid Aegis JSON files for import tests
|
||||
*/
|
||||
public function invalidAegisJsonFileProvider()
|
||||
public static function invalidAegisJsonFileProvider()
|
||||
{
|
||||
return [
|
||||
'encryptedAegisJsonFile' => [
|
||||
@ -777,9 +785,8 @@ public function invalidAegisJsonFileProvider()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider validPlainTextFileProvider
|
||||
*/
|
||||
#[DataProvider('validPlainTextFileProvider')]
|
||||
public function test_migrate_valid_plain_text_file_returns_success($file)
|
||||
{
|
||||
$response = $this->withHeaders(['Content-Type' => 'multipart/form-data'])
|
||||
@ -828,7 +835,7 @@ public function test_migrate_valid_plain_text_file_returns_success($file)
|
||||
/**
|
||||
* Provide valid Plain Text files for import tests
|
||||
*/
|
||||
public function validPlainTextFileProvider()
|
||||
public static function validPlainTextFileProvider()
|
||||
{
|
||||
return [
|
||||
'validPlainTextFile' => [
|
||||
@ -842,9 +849,8 @@ public function validPlainTextFileProvider()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider invalidPlainTextFileProvider
|
||||
*/
|
||||
#[DataProvider('invalidPlainTextFileProvider')]
|
||||
public function test_migrate_invalid_plain_text_file_returns_bad_request($file)
|
||||
{
|
||||
$response = $this->withHeaders(['Content-Type' => 'multipart/form-data'])
|
||||
@ -858,7 +864,7 @@ public function test_migrate_invalid_plain_text_file_returns_bad_request($file)
|
||||
/**
|
||||
* Provide invalid Plain Text files for import tests
|
||||
*/
|
||||
public function invalidPlainTextFileProvider()
|
||||
public static function invalidPlainTextFileProvider()
|
||||
{
|
||||
return [
|
||||
'invalidPlainTextFileEmpty' => [
|
||||
|
@ -6,11 +6,14 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\GroupAssignRequest
|
||||
* GroupAssignRequestTest test class
|
||||
*/
|
||||
#[CoversClass(GroupAssignRequest::class)]
|
||||
class GroupAssignRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -30,8 +33,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new GroupAssignRequest();
|
||||
@ -43,7 +47,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -55,8 +59,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new GroupAssignRequest();
|
||||
@ -68,7 +73,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -9,11 +9,14 @@
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Mockery;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\GroupStoreRequest
|
||||
* GroupStoreRequestTest test class
|
||||
*/
|
||||
#[CoversClass(GroupStoreRequest::class)]
|
||||
class GroupStoreRequestTest extends FeatureTestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -23,7 +26,7 @@ class GroupStoreRequestTest extends FeatureTestCase
|
||||
*/
|
||||
protected $user;
|
||||
|
||||
protected String $uniqueGroupName = 'MyGroup';
|
||||
const UNIQUE_GROUP_NAME = 'MyGroup';
|
||||
|
||||
/**
|
||||
* @test
|
||||
@ -50,8 +53,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = Mockery::mock(GroupStoreRequest::class)->makePartial();
|
||||
@ -66,7 +70,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -76,12 +80,13 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$group = Group::factory()->for($this->user)->create([
|
||||
'name' => $this->uniqueGroupName,
|
||||
'name' => self::UNIQUE_GROUP_NAME,
|
||||
]);
|
||||
|
||||
$request = Mockery::mock(GroupStoreRequest::class)->makePartial();
|
||||
@ -96,7 +101,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -109,7 +114,7 @@ public function provideInvalidData() : array
|
||||
'name' => 'mmmmmmoooooorrrrrreeeeeeettttttthhhhhhaaaaaaannnnnn32cccccchhhhhaaaaaarrrrrrsssssss', // max:32
|
||||
]],
|
||||
[[
|
||||
'name' => $this->uniqueGroupName, // unique
|
||||
'name' => self::UNIQUE_GROUP_NAME, // unique
|
||||
]],
|
||||
];
|
||||
}
|
||||
|
@ -6,12 +6,15 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\Classes\LocalFile;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\QrCodeDecodeRequest
|
||||
* QrCodeDecodeRequestTest test class
|
||||
*/
|
||||
#[CoversClass(QrCodeDecodeRequest::class)]
|
||||
class QrCodeDecodeRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -31,8 +34,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new QrCodeDecodeRequest();
|
||||
@ -44,7 +48,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
$file = LocalFile::fake()->validQrcode();
|
||||
|
||||
@ -56,8 +60,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new QrCodeDecodeRequest();
|
||||
@ -69,7 +74,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -7,16 +7,19 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\SettingStoreRequest
|
||||
* SettingStoreRequestTest test class
|
||||
*/
|
||||
#[CoversClass(SettingStoreRequest::class)]
|
||||
class SettingStoreRequestTest extends FeatureTestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
|
||||
protected String $uniqueKey = 'UniqueKey';
|
||||
const UNIQUE_KEY = 'UniqueKey';
|
||||
|
||||
/**
|
||||
* @test
|
||||
@ -33,8 +36,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new SettingStoreRequest();
|
||||
@ -46,7 +50,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -65,11 +69,12 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
Settings::set($this->uniqueKey, 'uniqueValue');
|
||||
Settings::set(self::UNIQUE_KEY, 'uniqueValue');
|
||||
|
||||
$request = new SettingStoreRequest();
|
||||
$validator = Validator::make($data, $request->rules());
|
||||
@ -80,7 +85,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -100,7 +105,7 @@ public function provideInvalidData() : array
|
||||
'value' => 'MyValue',
|
||||
]],
|
||||
[[
|
||||
'key' => $this->uniqueKey, // unique
|
||||
'key' => self::UNIQUE_KEY, // unique
|
||||
'value' => 'MyValue',
|
||||
]],
|
||||
];
|
||||
|
@ -2,15 +2,19 @@
|
||||
|
||||
namespace Tests\Api\v1\Requests;
|
||||
|
||||
use App\Api\v1\Requests\SettingStoreRequest;
|
||||
use App\Api\v1\Requests\SettingUpdateRequest;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\SettingUpdateRequest
|
||||
* SettingUpdateRequestTest test class
|
||||
*/
|
||||
#[CoversClass(SettingStoreRequest::class)]
|
||||
class SettingUpdateRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -30,8 +34,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new SettingUpdateRequest();
|
||||
@ -43,7 +48,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -59,8 +64,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new SettingUpdateRequest();
|
||||
@ -72,7 +78,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -6,11 +6,14 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\TwoFAccountBatchRequest
|
||||
* TwoFAccountBatchRequestTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccountBatchRequest::class)]
|
||||
class TwoFAccountBatchRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -30,8 +33,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountBatchRequest();
|
||||
@ -43,7 +47,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -56,8 +60,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountBatchRequest();
|
||||
@ -69,7 +74,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -7,11 +7,13 @@
|
||||
use App\Api\v1\Requests\TwoFAccountUriRequest;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\TwoFAccountDynamicRequest
|
||||
* TwoFAccountDynamicRequestTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccountDynamicRequest::class)]
|
||||
class TwoFAccountDynamicRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
|
@ -6,11 +6,14 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\TwoFAccountImportRequest
|
||||
* TwoFAccountImportRequestTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccountImportRequest::class)]
|
||||
class TwoFAccountImportRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -30,8 +33,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountImportRequest();
|
||||
@ -43,7 +47,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -53,8 +57,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountImportRequest();
|
||||
@ -66,7 +71,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -6,11 +6,14 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\TwoFAccountReorderRequest
|
||||
* TwoFAccountReorderRequestTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccountReorderRequest::class)]
|
||||
class TwoFAccountReorderRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -30,8 +33,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountReorderRequest();
|
||||
@ -43,7 +47,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -56,8 +60,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountReorderRequest();
|
||||
@ -69,7 +74,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -3,15 +3,19 @@
|
||||
namespace Tests\Api\v1\Requests;
|
||||
|
||||
use App\Api\v1\Requests\TwoFAccountStoreRequest;
|
||||
use App\Rules\IsBase32Encoded;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\TwoFAccountStoreRequest
|
||||
* @covers \App\Rules\IsBase32Encoded
|
||||
* TwoFAccountStoreRequestTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccountStoreRequest::class)]
|
||||
#[CoversClass(IsBase32Encoded::class)]
|
||||
class TwoFAccountStoreRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -31,8 +35,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountStoreRequest();
|
||||
@ -44,7 +49,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -106,8 +111,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountStoreRequest();
|
||||
@ -119,7 +125,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -3,15 +3,19 @@
|
||||
namespace Tests\Api\v1\Requests;
|
||||
|
||||
use App\Api\v1\Requests\TwoFAccountUpdateRequest;
|
||||
use App\Rules\IsBase32Encoded;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\TwoFAccountUpdateRequest
|
||||
* @covers \App\Rules\IsBase32Encoded
|
||||
* TwoFAccountUpdateRequestTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccountUpdateRequest::class)]
|
||||
#[CoversClass(IsBase32Encoded::class)]
|
||||
class TwoFAccountUpdateRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -31,8 +35,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountUpdateRequest();
|
||||
@ -44,7 +49,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -82,8 +87,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountUpdateRequest();
|
||||
@ -95,7 +101,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -6,11 +6,14 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Requests\TwoFAccountUriRequest
|
||||
* TwoFAccountUriRequestTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccountUriRequest::class)]
|
||||
class TwoFAccountUriRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -30,8 +33,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountUriRequest();
|
||||
@ -43,7 +47,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -60,8 +64,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new TwoFAccountUriRequest();
|
||||
@ -73,7 +78,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -3,12 +3,15 @@
|
||||
namespace Tests\Api\v1;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Providers\RouteServiceProvider;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Providers\RouteServiceProvider
|
||||
* ThrottlingTest test class
|
||||
*/
|
||||
#[CoversClass(RouteServiceProvider::class)]
|
||||
class ThrottlingTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,12 +2,15 @@
|
||||
|
||||
namespace Tests\Feature\Console;
|
||||
|
||||
use App\Console\Commands\CheckDbConnection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Console\Commands\CheckDbConnection
|
||||
* CheckDbConnectionTest test class
|
||||
*/
|
||||
#[CoversClass(CheckDbConnection::class)]
|
||||
class CheckDbConnectionTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -4,13 +4,16 @@
|
||||
|
||||
use App\Extensions\RemoteUserProvider;
|
||||
use App\Models\User;
|
||||
use App\Services\Auth\ReverseProxyGuard;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Extensions\RemoteUserProvider
|
||||
* @covers \App\Services\Auth\ReverseProxyGuard
|
||||
* RemoteUserProviderTest test class
|
||||
*/
|
||||
#[CoversClass(RemoteUserProvider::class)]
|
||||
#[CoversClass(ReverseProxyGuard::class)]
|
||||
class RemoteUserProviderTest extends FeatureTestCase
|
||||
{
|
||||
private const USER_NAME = 'John';
|
||||
|
@ -2,19 +2,24 @@
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Http\Controllers\Auth\ForgotPasswordController;
|
||||
use App\Http\Middleware\RejectIfAuthenticated;
|
||||
use App\Http\Middleware\RejectIfDemoMode;
|
||||
use App\Models\User;
|
||||
use Illuminate\Auth\Notifications\ResetPassword;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\ForgotPasswordController
|
||||
* @covers \App\Models\User
|
||||
* @covers \App\Http\Middleware\RejectIfDemoMode
|
||||
* @covers \App\Http\Middleware\RejectIfAuthenticated
|
||||
* ForgotPasswordControllerTest test class
|
||||
*/
|
||||
#[CoversClass(ForgotPasswordController::class)]
|
||||
#[CoversClass(User::class)]
|
||||
#[CoversClass(RejectIfDemoMode::class)]
|
||||
#[CoversClass(RejectIfAuthenticated::class)]
|
||||
class ForgotPasswordControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,18 +2,25 @@
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Http\Controllers\Auth\LoginController;
|
||||
use App\Http\Middleware\RejectIfAuthenticated;
|
||||
use App\Http\Middleware\RejectIfDemoMode;
|
||||
use App\Http\Middleware\RejectIfReverseProxy;
|
||||
use App\Http\Middleware\SkipIfAuthenticated;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\LoginController
|
||||
* @covers \App\Http\Middleware\RejectIfAuthenticated
|
||||
* @covers \App\Http\Middleware\RejectIfReverseProxy
|
||||
* @covers \App\Http\Middleware\RejectIfDemoMode
|
||||
* @covers \App\Http\Middleware\SkipIfAuthenticated
|
||||
* LoginTest test class
|
||||
*/
|
||||
#[CoversClass(LoginController::class)]
|
||||
#[CoversClass(RejectIfAuthenticated::class)]
|
||||
#[CoversClass(RejectIfReverseProxy::class)]
|
||||
#[CoversClass(RejectIfDemoMode::class)]
|
||||
#[CoversClass(SkipIfAuthenticated::class)]
|
||||
class LoginTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,12 +2,15 @@
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Http\Controllers\Auth\PasswordController;
|
||||
use App\Models\User;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\PasswordController
|
||||
* PasswordControllerTest test class
|
||||
*/
|
||||
#[CoversClass(PasswordController::class)]
|
||||
class PasswordControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -3,14 +3,18 @@
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Facades\Settings;
|
||||
use App\Http\Controllers\Auth\RegisterController;
|
||||
use App\Http\Requests\UserStoreRequest;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\RegisterController
|
||||
* @covers \App\Http\Requests\UserStoreRequest
|
||||
* RegisterControllerTest test class
|
||||
*/
|
||||
#[CoversClass(RegisterController::class)]
|
||||
#[CoversClass(UserStoreRequest::class)]
|
||||
class RegisterControllerTest extends FeatureTestCase
|
||||
{
|
||||
private const USERNAME = 'john doe';
|
||||
|
@ -2,16 +2,19 @@
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Http\Controllers\Auth\ResetPasswordController;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use Illuminate\Support\Facades\Password;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\ResetPasswordController
|
||||
* @covers \App\Models\User
|
||||
* ResetPasswordControllerTest test class
|
||||
*/
|
||||
#[CoversClass(ResetPasswordController::class)]
|
||||
#[CoversClass(User::class)]
|
||||
class ResetPasswordControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,17 +2,22 @@
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Http\Controllers\Auth\UserController;
|
||||
use App\Http\Middleware\RejectIfDemoMode;
|
||||
use App\Http\Requests\UserUpdateRequest;
|
||||
use App\Models\Group;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\UserController
|
||||
* @covers \App\Http\Middleware\RejectIfDemoMode
|
||||
* @covers \App\Http\Requests\UserUpdateRequest
|
||||
* UserControllerTest test class
|
||||
*/
|
||||
#[CoversClass(UserController::class)]
|
||||
#[CoversClass(RejectIfDemoMode::class)]
|
||||
#[CoversClass(UserUpdateRequest::class)]
|
||||
class UserControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,19 +2,25 @@
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Extensions\WebauthnCredentialBroker;
|
||||
use App\Http\Controllers\Auth\WebAuthnDeviceLostController;
|
||||
use App\Http\Requests\WebauthnDeviceLostRequest;
|
||||
use App\Models\User;
|
||||
use App\Notifications\WebauthnRecoveryNotification;
|
||||
use App\Providers\AuthServiceProvider;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
use Illuminate\Support\Facades\Notification;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\WebAuthnDeviceLostController
|
||||
* @covers \App\Notifications\WebauthnRecoveryNotification
|
||||
* @covers \App\Extensions\WebauthnCredentialBroker
|
||||
* @covers \App\Http\Requests\WebauthnDeviceLostRequest
|
||||
* @covers \App\Providers\AuthServiceProvider
|
||||
* WebAuthnDeviceLostControllerTest test class
|
||||
*/
|
||||
#[CoversClass(WebAuthnDeviceLostController::class)]
|
||||
#[CoversClass(WebauthnRecoveryNotification::class)]
|
||||
#[CoversClass(WebauthnCredentialBroker::class)]
|
||||
#[CoversClass(WebauthnDeviceLostRequest::class)]
|
||||
#[CoversClass(AuthServiceProvider::class)]
|
||||
class WebAuthnDeviceLostControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,18 +2,22 @@
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Extensions\WebauthnTwoFAuthUserProvider;
|
||||
use App\Http\Controllers\Auth\WebAuthnLoginController;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Laragear\WebAuthn\Assertion\Validator\AssertionValidator;
|
||||
use Laragear\WebAuthn\WebAuthn;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\WebAuthnLoginController
|
||||
* @covers \App\Models\User
|
||||
* @covers \App\Extensions\WebauthnTwoFAuthUserProvider
|
||||
* WebAuthnLoginControllerTest test class
|
||||
*/
|
||||
#[CoversClass(WebAuthnLoginController::class)]
|
||||
#[CoversClass(User::class)]
|
||||
#[CoversClass(WebauthnTwoFAuthUserProvider::class)]
|
||||
class WebAuthnLoginControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,16 +2,21 @@
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Http\Controllers\Auth\WebAuthnManageController;
|
||||
use App\Http\Middleware\RejectIfReverseProxy;
|
||||
use App\Models\Traits\WebAuthnManageCredentials;
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\WebAuthnManageController
|
||||
* @covers \App\Http\Middleware\RejectIfReverseProxy
|
||||
* @covers \App\Models\Traits\WebAuthnManageCredentials
|
||||
* WebAuthnManageControllerTest test class
|
||||
*/
|
||||
#[CoversClass(WebAuthnManageController::class)]
|
||||
#[CoversClass(RejectIfReverseProxy::class)]
|
||||
#[CoversClass(WebAuthnManageCredentials::class)]
|
||||
class WebAuthnManageControllerTest extends FeatureTestCase
|
||||
{
|
||||
// use WithoutMiddleware;
|
||||
|
@ -2,18 +2,24 @@
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Extensions\WebauthnCredentialBroker;
|
||||
use App\Http\Controllers\Auth\WebAuthnRecoveryController;
|
||||
use App\Http\Requests\WebauthnRecoveryRequest;
|
||||
use App\Models\User;
|
||||
use App\Providers\AuthServiceProvider;
|
||||
use Database\Factories\UserFactory;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\WebAuthnRecoveryController
|
||||
* @covers \App\Extensions\WebauthnCredentialBroker
|
||||
* @covers \App\Http\Requests\WebauthnRecoveryRequest
|
||||
* @covers \App\Providers\AuthServiceProvider
|
||||
* WebAuthnRecoveryControllerTest test class
|
||||
*/
|
||||
#[CoversClass(WebAuthnRecoveryController::class)]
|
||||
#[CoversClass(WebauthnCredentialBroker::class)]
|
||||
#[CoversClass(WebauthnRecoveryRequest::class)]
|
||||
#[CoversClass(AuthServiceProvider::class)]
|
||||
class WebAuthnRecoveryControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -2,17 +2,20 @@
|
||||
|
||||
namespace Tests\Feature\Http\Auth;
|
||||
|
||||
use App\Http\Controllers\Auth\WebAuthnRegisterController;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Laragear\WebAuthn\Http\Requests\AttestationRequest;
|
||||
use Laragear\WebAuthn\Http\Requests\AttestedRequest;
|
||||
use Laragear\WebAuthn\JsonTransport;
|
||||
use Laragear\WebAuthn\WebAuthn;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\Auth\WebAuthnRegisterController
|
||||
* WebAuthnRegisterControllerTest test class
|
||||
*/
|
||||
#[CoversClass(WebAuthnRegisterController::class)]
|
||||
class WebAuthnRegisterControllerTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -6,11 +6,14 @@
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Requests\LoginRequest
|
||||
* LoginRequestTest test class
|
||||
*/
|
||||
#[CoversClass(LoginRequest::class)]
|
||||
class LoginRequestTest extends FeatureTestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -26,8 +29,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
User::factory()->create([
|
||||
@ -43,7 +47,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -58,8 +62,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
User::factory()->create([
|
||||
@ -75,7 +80,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -6,11 +6,14 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Requests\UserDeleteRequest
|
||||
* UserDeleteRequestTest test class
|
||||
*/
|
||||
#[CoversClass(UserDeleteRequest::class)]
|
||||
class UserDeleteRequestTest extends FeatureTestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -30,8 +33,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new UserDeleteRequest();
|
||||
@ -43,7 +47,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -53,8 +57,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new UserDeleteRequest();
|
||||
@ -66,7 +71,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -6,11 +6,14 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Requests\UserPatchPwdRequest
|
||||
* UserPatchPwdRequestTest test class
|
||||
*/
|
||||
#[CoversClass(UserPatchPwdRequest::class)]
|
||||
class UserPatchPwdRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -30,8 +33,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new UserPatchPwdRequest();
|
||||
@ -43,7 +47,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -55,8 +59,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new UserPatchPwdRequest();
|
||||
@ -68,7 +73,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -6,11 +6,14 @@
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Requests\UserStoreRequest
|
||||
* UserStoreRequestTest test class
|
||||
*/
|
||||
#[CoversClass(UserStoreRequest::class)]
|
||||
class UserStoreRequestTest extends FeatureTestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -26,8 +29,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
User::factory()->create([
|
||||
@ -44,7 +48,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -63,8 +67,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
User::factory()->create([
|
||||
@ -81,7 +86,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -8,11 +8,14 @@
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Mockery;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Requests\UserUpdateRequest
|
||||
* UserUpdateRequestTest test class
|
||||
*/
|
||||
#[CoversClass(UserUpdateRequest::class)]
|
||||
class UserUpdateRequestTest extends FeatureTestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -32,8 +35,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
/**
|
||||
@ -56,7 +60,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -78,8 +82,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
/**
|
||||
@ -107,7 +112,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -5,18 +5,22 @@
|
||||
use App\Http\Requests\WebauthnAssertedRequest;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Requests\WebauthnAssertedRequest
|
||||
* WebauthnAssertedRequestTest test class
|
||||
*/
|
||||
#[CoversClass(WebauthnAssertedRequest::class)]
|
||||
class WebauthnAssertedRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new WebauthnAssertedRequest();
|
||||
@ -28,7 +32,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -47,8 +51,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new WebauthnAssertedRequest();
|
||||
@ -60,7 +65,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -6,11 +6,14 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Requests\WebauthnRenameRequest
|
||||
* WebauthnRenameRequestTest test class
|
||||
*/
|
||||
#[CoversClass(WebauthnRenameRequest::class)]
|
||||
class WebauthnRenameRequestTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
@ -30,8 +33,9 @@ public function test_user_is_authorized()
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideValidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideValidData')]
|
||||
public function test_valid_data(array $data) : void
|
||||
{
|
||||
$request = new WebauthnRenameRequest();
|
||||
@ -43,7 +47,7 @@ public function test_valid_data(array $data) : void
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideValidData() : array
|
||||
public static function provideValidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
@ -53,8 +57,9 @@ public function provideValidData() : array
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideInvalidData
|
||||
* @test
|
||||
*/
|
||||
#[DataProvider('provideInvalidData')]
|
||||
public function test_invalid_data(array $data) : void
|
||||
{
|
||||
$request = new WebauthnRenameRequest();
|
||||
@ -66,7 +71,7 @@ public function test_invalid_data(array $data) : void
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideInvalidData() : array
|
||||
public static function provideInvalidData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -2,14 +2,17 @@
|
||||
|
||||
namespace Tests\Feature\Http;
|
||||
|
||||
use App\Http\Controllers\SystemController;
|
||||
use App\Models\User;
|
||||
use App\Services\ReleaseRadarService;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Http\Controllers\SystemController
|
||||
* SystemControllerTest test class
|
||||
*/
|
||||
#[CoversClass(SystemController::class)]
|
||||
class SystemControllerTest extends FeatureTestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
|
@ -9,13 +9,16 @@
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Mockery\MockInterface;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\Data\HttpRequestTestData;
|
||||
use Tests\Data\OtpTestData;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Models\TwoFAccount
|
||||
* TwoFAccountModelTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccount::class)]
|
||||
class TwoFAccountModelTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
@ -739,9 +742,8 @@ public function test_equals_returns_false()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider iconResourceProvider
|
||||
*/
|
||||
#[DataProvider('iconResourceProvider')]
|
||||
public function test_set_icon_stores_and_set_the_icon($res, $ext)
|
||||
{
|
||||
Storage::fake('imagesLink');
|
||||
@ -759,7 +761,7 @@ public function test_set_icon_stores_and_set_the_icon($res, $ext)
|
||||
/**
|
||||
* Provide data for Icon store tests
|
||||
*/
|
||||
public function iconResourceProvider()
|
||||
public static function iconResourceProvider()
|
||||
{
|
||||
return [
|
||||
'PNG' => [
|
||||
@ -787,9 +789,8 @@ public function iconResourceProvider()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider invalidIconResourceProvider
|
||||
*/
|
||||
#[DataProvider('invalidIconResourceProvider')]
|
||||
public function test_set_invalid_icon_ends_without_error($res, $ext)
|
||||
{
|
||||
Storage::fake('imagesLink');
|
||||
@ -807,7 +808,7 @@ public function test_set_invalid_icon_ends_without_error($res, $ext)
|
||||
/**
|
||||
* Provide data for Icon store tests
|
||||
*/
|
||||
public function invalidIconResourceProvider()
|
||||
public static function invalidIconResourceProvider()
|
||||
{
|
||||
return [
|
||||
'INVALID_PNG' => [
|
||||
|
@ -3,11 +3,13 @@
|
||||
namespace Tests\Feature\Models;
|
||||
|
||||
use App\Models\User;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Models\User
|
||||
* UserModelTest test class
|
||||
*/
|
||||
#[CoversClass(User::class)]
|
||||
class UserModelTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -6,13 +6,16 @@
|
||||
use App\Models\Group;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Models\User;
|
||||
use App\Services\GroupService;
|
||||
use Illuminate\Auth\Access\AuthorizationException;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Services\GroupService
|
||||
* @covers \App\Facades\Groups
|
||||
* GroupServiceTest test class
|
||||
*/
|
||||
#[CoversClass(GroupService::class)]
|
||||
#[CoversClass(Groups::class)]
|
||||
class GroupServiceTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -6,12 +6,14 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\Data\HttpRequestTestData;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Services\LogoService
|
||||
* LogoServiceTest test class
|
||||
*/
|
||||
#[CoversClass(LogoService::class)]
|
||||
class LogoServiceTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
|
@ -3,13 +3,16 @@
|
||||
namespace Tests\Feature\Services;
|
||||
|
||||
use App\Facades\QrCode;
|
||||
use App\Services\QrCodeService;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\Classes\LocalFile;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Services\QrCodeService
|
||||
* @covers \App\Facades\QrCode
|
||||
* QrCodeServiceTest test class
|
||||
*/
|
||||
#[CoversClass(QrCodeService::class)]
|
||||
#[CoversClass(QrCode::class)]
|
||||
class QrCodeServiceTest extends FeatureTestCase
|
||||
{
|
||||
private const STRING_TO_ENCODE = 'stringToEncode';
|
||||
|
@ -7,12 +7,14 @@
|
||||
use Facades\App\Services\ReleaseRadarService;
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\Data\HttpRequestTestData;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Services\ReleaseRadarService
|
||||
* ReleaseRadarServiceTest test class
|
||||
*/
|
||||
#[CoversClass(App\Services\ReleaseRadarService::class)]
|
||||
class ReleaseRadarServiceTest extends FeatureTestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
|
@ -8,12 +8,15 @@
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Services\SettingService
|
||||
* @covers \App\Facades\Settings
|
||||
* SettingServiceTest test class
|
||||
*/
|
||||
#[CoversClass(SettingService::class)]
|
||||
#[CoversClass(Settings::class)]
|
||||
class SettingServiceTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
@ -237,9 +240,8 @@ public function test_set_useEncryption_off_decrypts_all_accounts()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider provideUndecipherableData
|
||||
*/
|
||||
#[DataProvider('provideUndecipherableData')]
|
||||
public function test_set_useEncryption_off_returns_exception_when_data_are_undecipherable(array $data)
|
||||
{
|
||||
$this->expectException(\App\Exceptions\DbEncryptionException::class);
|
||||
@ -258,7 +260,7 @@ public function test_set_useEncryption_off_returns_exception_when_data_are_undec
|
||||
/**
|
||||
* Provide invalid data for validation test
|
||||
*/
|
||||
public function provideUndecipherableData() : array
|
||||
public static function provideUndecipherableData() : array
|
||||
{
|
||||
return [
|
||||
[[
|
||||
|
@ -6,14 +6,17 @@
|
||||
use App\Models\Group;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Models\User;
|
||||
use App\Services\TwoFAccountService;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\Data\MigrationTestData;
|
||||
use Tests\Data\OtpTestData;
|
||||
use Tests\FeatureTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Services\TwoFAccountService
|
||||
* @covers \App\Facades\TwoFAccounts
|
||||
* TwoFAccountServiceTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccountService::class)]
|
||||
#[CoversClass(TwoFAccounts::class)]
|
||||
class TwoFAccountServiceTest extends FeatureTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -13,11 +13,13 @@
|
||||
use Illuminate\Foundation\Testing\WithoutMiddleware;
|
||||
use Illuminate\Http\Request;
|
||||
use Mockery;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Api\v1\Controllers\GroupController
|
||||
* GroupControllerTest test class
|
||||
*/
|
||||
#[CoversClass(GroupController::class)]
|
||||
class GroupControllerTest extends TestCase
|
||||
{
|
||||
use WithoutMiddleware;
|
||||
|
@ -4,11 +4,13 @@
|
||||
|
||||
use App\Events\GroupDeleted;
|
||||
use App\Models\Group;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Events\GroupDeleted
|
||||
* GroupDeletedTest test class
|
||||
*/
|
||||
#[CoversClass(GroupDeleted::class)]
|
||||
class GroupDeletedTest extends TestCase
|
||||
{
|
||||
/**
|
||||
|
@ -4,11 +4,13 @@
|
||||
|
||||
use App\Events\GroupDeleting;
|
||||
use App\Models\Group;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Events\GroupDeleting
|
||||
* GroupDeletingTest test class
|
||||
*/
|
||||
#[CoversClass(GroupDeleting::class)]
|
||||
class GroupDeletingTest extends TestCase
|
||||
{
|
||||
/**
|
||||
|
@ -6,11 +6,13 @@
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Services\SettingService;
|
||||
use Mockery\MockInterface;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Events\TwoFAccountDeleted
|
||||
* TwoFAccountDeletedTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccountDeleted::class)]
|
||||
class TwoFAccountDeletedTest extends TestCase
|
||||
{
|
||||
/**
|
||||
|
@ -15,18 +15,20 @@
|
||||
use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Exceptions\Handler
|
||||
* HandlerTest test class
|
||||
*/
|
||||
#[CoversClass(Handler::class)]
|
||||
class HandlerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider provideExceptionsforBadRequest
|
||||
*/
|
||||
#[DataProvider('provideExceptionsforBadRequest')]
|
||||
public function test_exceptions_returns_badRequest_json_response($exception)
|
||||
{
|
||||
$request = $this->createMock(Request::class);
|
||||
@ -50,7 +52,7 @@ public function test_exceptions_returns_badRequest_json_response($exception)
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideExceptionsforBadRequest() : array
|
||||
public static function provideExceptionsforBadRequest() : array
|
||||
{
|
||||
return [
|
||||
[
|
||||
@ -85,9 +87,8 @@ public function provideExceptionsforBadRequest() : array
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider provideExceptionsforNotFound
|
||||
*/
|
||||
#[DataProvider('provideExceptionsforNotFound')]
|
||||
public function test_exceptions_returns_notFound_json_response($exception)
|
||||
{
|
||||
$request = $this->createMock(Request::class);
|
||||
@ -111,7 +112,7 @@ public function test_exceptions_returns_notFound_json_response($exception)
|
||||
/**
|
||||
* Provide Valid data for validation test
|
||||
*/
|
||||
public function provideExceptionsforNotFound() : array
|
||||
public static function provideExceptionsforNotFound() : array
|
||||
{
|
||||
return [
|
||||
[
|
||||
|
@ -7,11 +7,13 @@
|
||||
use App\Models\Group;
|
||||
use App\Models\TwoFAccount;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\ModelTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Models\Group
|
||||
* GroupModelTest test class
|
||||
*/
|
||||
#[CoversClass(Group::class)]
|
||||
class GroupModelTest extends ModelTestCase
|
||||
{
|
||||
/**
|
||||
|
@ -3,18 +3,20 @@
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Helpers\Helpers;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Helpers\Helpers
|
||||
* HelpersTest test class
|
||||
*/
|
||||
#[CoversClass(Helpers::class)]
|
||||
class HelpersTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider versionNumberProvider
|
||||
*/
|
||||
#[DataProvider('versionNumberProvider')]
|
||||
public function test_cleanVersionNumber_returns_cleaned_version($dirtyVersion, $expected)
|
||||
{
|
||||
$cleanedVersion = Helpers::cleanVersionNumber($dirtyVersion);
|
||||
@ -25,7 +27,7 @@ public function test_cleanVersionNumber_returns_cleaned_version($dirtyVersion, $
|
||||
/**
|
||||
* Provide data for cleanVersionNumber() tests
|
||||
*/
|
||||
public function versionNumberProvider()
|
||||
public static function versionNumberProvider()
|
||||
{
|
||||
return [
|
||||
[
|
||||
@ -49,9 +51,8 @@ public function versionNumberProvider()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider invalidVersionNumberProvider
|
||||
*/
|
||||
#[DataProvider('invalidVersionNumberProvider')]
|
||||
public function test_cleanVersionNumber_returns_false_with_invalid_semver($dirtyVersion)
|
||||
{
|
||||
$cleanedVersion = Helpers::cleanVersionNumber($dirtyVersion);
|
||||
@ -62,7 +63,7 @@ public function test_cleanVersionNumber_returns_false_with_invalid_semver($dirty
|
||||
/**
|
||||
* Provide data for cleanVersionNumber() tests
|
||||
*/
|
||||
public function invalidVersionNumberProvider()
|
||||
public static function invalidVersionNumberProvider()
|
||||
{
|
||||
return [
|
||||
[
|
||||
@ -85,9 +86,8 @@ public function invalidVersionNumberProvider()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider toBase32PaddedStringProvider
|
||||
*/
|
||||
#[DataProvider('toBase32PaddedStringProvider')]
|
||||
public function test_toBase32Format_returns_base32_formated_string($str, $expected)
|
||||
{
|
||||
$base32str = Helpers::PadToBase32Format($str);
|
||||
@ -98,7 +98,7 @@ public function test_toBase32Format_returns_base32_formated_string($str, $expect
|
||||
/**
|
||||
* Provide data for cleanVersionNumber() tests
|
||||
*/
|
||||
public function toBase32PaddedStringProvider()
|
||||
public static function toBase32PaddedStringProvider()
|
||||
{
|
||||
return [
|
||||
'SHORT_STRING' => [
|
||||
@ -138,9 +138,8 @@ public function toBase32PaddedStringProvider()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider commaSeparatedToArrayProvider
|
||||
*/
|
||||
#[DataProvider('commaSeparatedToArrayProvider')]
|
||||
public function test_commaSeparatedToArray_returns_ids_in_array($str, $expected)
|
||||
{
|
||||
$array = Helpers::commaSeparatedToArray($str);
|
||||
@ -151,7 +150,7 @@ public function test_commaSeparatedToArray_returns_ids_in_array($str, $expected)
|
||||
/**
|
||||
* Provide data for cleanVersionNumber() tests
|
||||
*/
|
||||
public function commaSeparatedToArrayProvider()
|
||||
public static function commaSeparatedToArrayProvider()
|
||||
{
|
||||
return [
|
||||
'NOMINAL' => [
|
||||
@ -167,9 +166,8 @@ public function commaSeparatedToArrayProvider()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider invalidCommaSeparatedToArrayProvider
|
||||
*/
|
||||
#[DataProvider('invalidCommaSeparatedToArrayProvider')]
|
||||
public function test_commaSeparatedToArray_returns_unchanged_ids($str, $expected)
|
||||
{
|
||||
$array = Helpers::commaSeparatedToArray($str);
|
||||
@ -180,7 +178,7 @@ public function test_commaSeparatedToArray_returns_unchanged_ids($str, $expected
|
||||
/**
|
||||
* Provide data for cleanVersionNumber() tests
|
||||
*/
|
||||
public function invalidCommaSeparatedToArrayProvider()
|
||||
public static function invalidCommaSeparatedToArrayProvider()
|
||||
{
|
||||
return [
|
||||
'INVALID_IDS_LEADING_SPACES' => [
|
||||
|
@ -9,11 +9,13 @@
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Mockery\MockInterface;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Listeners\CleanIconStorage
|
||||
* CleanIconStorageTest test class
|
||||
*/
|
||||
#[CoversClass(CleanIconStorage::class)]
|
||||
class CleanIconStorageTest extends TestCase
|
||||
{
|
||||
/**
|
||||
|
@ -8,20 +8,22 @@
|
||||
use App\Models\TwoFAccount;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Mockery\MockInterface;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\PreserveGlobalState;
|
||||
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Listeners\DissociateTwofaccountFromGroup
|
||||
* DissociateTwofaccountFromGroupTest test class
|
||||
*/
|
||||
#[CoversClass(DissociateTwofaccountFromGroup::class)]
|
||||
class DissociateTwofaccountFromGroupTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
*
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
#[RunInSeparateProcess]
|
||||
#[PreserveGlobalState(false)]
|
||||
public function test_twofaccount_is_released_on_group_deletion()
|
||||
{
|
||||
$this->mock('alias:' . TwoFAccount::class, function (MockInterface $twoFAccount) {
|
||||
|
@ -7,11 +7,13 @@
|
||||
use App\Services\ReleaseRadarService;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Mockery\MockInterface;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Listeners\ReleaseRadar
|
||||
* ReleaseRadarTest test class
|
||||
*/
|
||||
#[CoversClass(ReleaseRadar::class)]
|
||||
class ReleaseRadarTest extends TestCase
|
||||
{
|
||||
/**
|
||||
|
@ -5,11 +5,13 @@
|
||||
use App\Events\GroupDeleted;
|
||||
use App\Listeners\ResetUsersPreference;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Listeners\ResetUsersPreference
|
||||
* ResetUsersPreferenceTest test class
|
||||
*/
|
||||
#[CoversClass(ResetUsersPreference::class)]
|
||||
class ResetUsersPreferenceTest extends TestCase
|
||||
{
|
||||
/**
|
||||
|
@ -7,6 +7,7 @@
|
||||
use App\Exceptions\UnsupportedMigrationException;
|
||||
use App\Factories\MigratorFactory;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Providers\MigrationServiceProvider;
|
||||
use App\Services\Migrators\AegisMigrator;
|
||||
use App\Services\Migrators\GoogleAuthMigrator;
|
||||
use App\Services\Migrators\Migrator;
|
||||
@ -18,22 +19,27 @@
|
||||
use Mockery;
|
||||
use Mockery\MockInterface;
|
||||
use ParagonIE\ConstantTime\Base32;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\PreserveGlobalState;
|
||||
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
|
||||
use PHPUnit\Framework\Attributes\UsesClass;
|
||||
use Tests\Data\MigrationTestData;
|
||||
use Tests\Data\OtpTestData;
|
||||
use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Providers\MigrationServiceProvider
|
||||
* @covers \App\Factories\MigratorFactory
|
||||
* @covers \App\Services\Migrators\Migrator
|
||||
* @covers \App\Services\Migrators\AegisMigrator
|
||||
* @covers \App\Services\Migrators\TwoFASMigrator
|
||||
* @covers \App\Services\Migrators\PlainTextMigrator
|
||||
* @covers \App\Services\Migrators\GoogleAuthMigrator
|
||||
* @covers \App\Services\Migrators\TwoFAuthMigrator
|
||||
*
|
||||
* @uses \App\Models\TwoFAccount
|
||||
* MigratorTest test class
|
||||
*/
|
||||
#[CoversClass(MigrationServiceProvider::class)]
|
||||
#[CoversClass(MigratorFactory::class)]
|
||||
#[CoversClass(Migrator::class)]
|
||||
#[CoversClass(AegisMigrator::class)]
|
||||
#[CoversClass(TwoFASMigrator::class)]
|
||||
#[CoversClass(PlainTextMigrator::class)]
|
||||
#[CoversClass(GoogleAuthMigrator::class)]
|
||||
#[CoversClass(TwoFAuthMigrator::class)]
|
||||
#[UsesClass(TwoFAccount::class)]
|
||||
class MigratorTest extends TestCase
|
||||
{
|
||||
/**
|
||||
@ -137,9 +143,8 @@ public function setUp() : void
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider validMigrationsProvider
|
||||
*/
|
||||
#[DataProvider('validMigrationsProvider')]
|
||||
public function test_migrate_returns_consistent_accounts(Migrator $migrator, mixed $payload, string $expected, bool $hasSteam)
|
||||
{
|
||||
$accounts = $migrator->migrate($payload);
|
||||
@ -170,7 +175,7 @@ public function test_migrate_returns_consistent_accounts(Migrator $migrator, mix
|
||||
/**
|
||||
* Provide data for TwoFAccount store tests
|
||||
*/
|
||||
public function validMigrationsProvider()
|
||||
public static function validMigrationsProvider()
|
||||
{
|
||||
return [
|
||||
'PLAIN_TEXT_PAYLOAD' => [
|
||||
@ -214,9 +219,8 @@ public function validMigrationsProvider()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider invalidMigrationsProvider
|
||||
*/
|
||||
#[DataProvider('invalidMigrationsProvider')]
|
||||
public function test_migrate_with_invalid_payload_returns_InvalidMigrationDataException(Migrator $migrator, mixed $payload)
|
||||
{
|
||||
$this->expectException(InvalidMigrationDataException::class);
|
||||
@ -227,7 +231,7 @@ public function test_migrate_with_invalid_payload_returns_InvalidMigrationDataEx
|
||||
/**
|
||||
* Provide data for TwoFAccount store tests
|
||||
*/
|
||||
public function invalidMigrationsProvider()
|
||||
public static function invalidMigrationsProvider()
|
||||
{
|
||||
return [
|
||||
'INVALID_PLAIN_TEXT_NO_URI' => [
|
||||
@ -284,9 +288,8 @@ public function invalidMigrationsProvider()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider migrationWithInvalidAccountsProvider
|
||||
*/
|
||||
#[DataProvider('migrationWithInvalidAccountsProvider')]
|
||||
public function test_migrate_returns_fake_accounts(Migrator $migrator, mixed $payload)
|
||||
{
|
||||
$accounts = $migrator->migrate($payload);
|
||||
@ -303,7 +306,7 @@ public function test_migrate_returns_fake_accounts(Migrator $migrator, mixed $pa
|
||||
/**
|
||||
* Provide data for TwoFAccount store tests
|
||||
*/
|
||||
public function migrationWithInvalidAccountsProvider()
|
||||
public static function migrationWithInvalidAccountsProvider()
|
||||
{
|
||||
return [
|
||||
'PLAIN_TEXT_PAYLOAD_WITH_INVALID_URI' => [
|
||||
@ -327,11 +330,9 @@ public function migrationWithInvalidAccountsProvider()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
*
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
#[RunInSeparateProcess]
|
||||
#[PreserveGlobalState(false)]
|
||||
public function test_migrate_gauth_returns_fake_accounts()
|
||||
{
|
||||
$this->mock('alias:' . Base32::class, function (MockInterface $baseEncoder) {
|
||||
@ -353,9 +354,8 @@ public function test_migrate_gauth_returns_fake_accounts()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider AegisWithIconMigrationProvider
|
||||
*/
|
||||
#[DataProvider('AegisWithIconMigrationProvider')]
|
||||
public function test_migrate_aegis_payload_with_icon_sets_and_stores_the_icon($migration)
|
||||
{
|
||||
Storage::fake('icons');
|
||||
@ -372,7 +372,7 @@ public function test_migrate_aegis_payload_with_icon_sets_and_stores_the_icon($m
|
||||
/**
|
||||
* Provide data for TwoFAccount store tests
|
||||
*/
|
||||
public function AegisWithIconMigrationProvider()
|
||||
public static function AegisWithIconMigrationProvider()
|
||||
{
|
||||
return [
|
||||
'SVG' => [
|
||||
@ -406,9 +406,8 @@ public function test_migrate_aegis_payload_with_unsupported_icon_does_not_fail()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider TwoFAuthWithIconMigrationProvider
|
||||
*/
|
||||
#[DataProvider('TwoFAuthWithIconMigrationProvider')]
|
||||
public function test_migrate_2fauth_payload_with_icon_sets_and_stores_the_icon($migration)
|
||||
{
|
||||
Storage::fake('icons');
|
||||
@ -425,7 +424,7 @@ public function test_migrate_2fauth_payload_with_icon_sets_and_stores_the_icon($
|
||||
/**
|
||||
* Provide data for TwoFAccount store tests
|
||||
*/
|
||||
public function TwoFAuthWithIconMigrationProvider()
|
||||
public static function TwoFAuthWithIconMigrationProvider()
|
||||
{
|
||||
return [
|
||||
'SVG' => [
|
||||
@ -465,9 +464,8 @@ public function test_migrate_2fauth_payload_with_unsupported_icon_does_not_fail(
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider factoryProvider
|
||||
*/
|
||||
#[DataProvider('factoryProvider')]
|
||||
public function test_factory_returns_relevant_migrator($payload, $migratorClass)
|
||||
{
|
||||
$factory = new MigratorFactory();
|
||||
@ -480,7 +478,7 @@ public function test_factory_returns_relevant_migrator($payload, $migratorClass)
|
||||
/**
|
||||
* Provide data for TwoFAccount store tests
|
||||
*/
|
||||
public function factoryProvider()
|
||||
public static function factoryProvider()
|
||||
{
|
||||
return [
|
||||
'VALID_PLAIN_TEXT_PAYLOAD' => [
|
||||
@ -523,9 +521,8 @@ public function test_factory_throw_UnsupportedMigrationException()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider encryptedMigrationDataProvider
|
||||
*/
|
||||
#[DataProvider('encryptedMigrationDataProvider')]
|
||||
public function test_factory_throw_EncryptedMigrationException($payload)
|
||||
{
|
||||
$this->expectException(EncryptedMigrationException::class);
|
||||
@ -538,7 +535,7 @@ public function test_factory_throw_EncryptedMigrationException($payload)
|
||||
/**
|
||||
* Provide data for TwoFAccount store tests
|
||||
*/
|
||||
public function encryptedMigrationDataProvider()
|
||||
public static function encryptedMigrationDataProvider()
|
||||
{
|
||||
return [
|
||||
'ENCRYPTED_AEGIS_JSON_MIGRATION_PAYLOAD' => [
|
||||
|
@ -9,11 +9,16 @@
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Mockery\MockInterface;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\Attributes\PreserveGlobalState;
|
||||
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
|
||||
use Tests\ModelTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Models\TwoFAccount
|
||||
* TwoFAccountModelTest test class
|
||||
*/
|
||||
#[CoversClass(TwoFAccount::class)]
|
||||
class TwoFAccountModelTest extends ModelTestCase
|
||||
{
|
||||
/**
|
||||
@ -39,9 +44,8 @@ public function test_model_configuration()
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider provideSensitiveAttributes
|
||||
*/
|
||||
#[DataProvider('provideSensitiveAttributes')]
|
||||
public function test_sensitive_attributes_are_stored_encrypted(string $attribute)
|
||||
{
|
||||
$settingService = $this->mock(SettingService::class, function (MockInterface $settingService) {
|
||||
@ -60,7 +64,7 @@ public function test_sensitive_attributes_are_stored_encrypted(string $attribute
|
||||
/**
|
||||
* Provide attributes to test for encryption
|
||||
*/
|
||||
public function provideSensitiveAttributes() : array
|
||||
public static function provideSensitiveAttributes() : array
|
||||
{
|
||||
return [
|
||||
[
|
||||
@ -77,9 +81,8 @@ public function provideSensitiveAttributes() : array
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider provideSensitiveAttributes
|
||||
*/
|
||||
#[DataProvider('provideSensitiveAttributes')]
|
||||
public function test_sensitive_attributes_are_returned_clear(string $attribute)
|
||||
{
|
||||
$settingService = $this->mock(SettingService::class, function (MockInterface $settingService) {
|
||||
@ -95,9 +98,8 @@ public function test_sensitive_attributes_are_returned_clear(string $attribute)
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @dataProvider provideSensitiveAttributes
|
||||
*/
|
||||
#[DataProvider('provideSensitiveAttributes')]
|
||||
public function test_indecipherable_attributes_returns_masked_value(string $attribute)
|
||||
{
|
||||
$settingService = $this->mock(SettingService::class, function (MockInterface $settingService) {
|
||||
@ -116,11 +118,9 @@ public function test_indecipherable_attributes_returns_masked_value(string $attr
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* @runInSeparateProcess
|
||||
*
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
#[RunInSeparateProcess]
|
||||
#[PreserveGlobalState(false)]
|
||||
public function test_secret_is_uppercased_and_padded_at_setup()
|
||||
{
|
||||
$settingService = $this->mock(SettingService::class, function (MockInterface $settingService) {
|
||||
|
@ -5,11 +5,13 @@
|
||||
use App\Models\Group;
|
||||
use App\Models\TwoFAccount;
|
||||
use App\Models\User;
|
||||
use PHPUnit\Framework\Attributes\CoversClass;
|
||||
use Tests\ModelTestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Models\User
|
||||
* UserModelTest test class
|
||||
*/
|
||||
#[CoversClass(User::class)]
|
||||
class UserModelTest extends ModelTestCase
|
||||
{
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user