1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Ikechukwukalu\Sanctumauthstarter\Tests; |
4
|
|
|
|
5
|
|
|
use Ikechukwukalu\Sanctumauthstarter\SanctumauthstarterServiceProvider; |
6
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase; |
7
|
|
|
use Orchestra\Testbench\TestCase as BaseTestCase; |
8
|
|
|
use Stevebauman\Location\LocationServiceProvider; |
9
|
|
|
|
10
|
|
|
abstract class TestCase extends BaseTestCase |
11
|
|
|
{ |
12
|
|
|
use RefreshDatabase; |
|
|
|
|
13
|
|
|
|
14
|
|
|
public function setUp(): void |
15
|
|
|
{ |
16
|
|
|
parent::setUp(); |
17
|
|
|
} |
18
|
|
|
|
19
|
|
|
protected function defineDatabaseMigrations() |
20
|
|
|
{ |
21
|
|
|
$this->loadLaravelMigrations(); |
22
|
|
|
$this->loadMigrationsFrom(__DIR__.'/../src/migrations'); |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
protected function defineRoutes($router) |
26
|
|
|
{ |
27
|
|
|
$router->post('api/auth/register', [\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\RegisterController::class, |
|
|
|
|
28
|
|
|
'register'])->name('register'); |
29
|
|
|
|
30
|
|
|
$router->post('api/auth/login', [\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\LoginController::class, |
|
|
|
|
31
|
|
|
'login'])->name('login'); |
32
|
|
|
|
33
|
|
|
$router->post('api/auth/logout', [\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\LogoutController::class, |
|
|
|
|
34
|
|
|
'logout'])->name('logout'); |
35
|
|
|
|
36
|
|
|
$router->post('api/auth/logout-from-all-sessions', [\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\LogoutController::class, |
37
|
|
|
'logoutFromAllSessions'])->name('logoutFromAllSessions'); |
38
|
|
|
|
39
|
|
|
$router->get('auth/verify/email/{id}', [\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\VerificationController::class, |
|
|
|
|
40
|
|
|
'verifyUserEmail'])->name('verification.verify'); |
41
|
|
|
|
42
|
|
|
$router->post('api/auth/resend/verify/email', [\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\VerificationController::class, |
43
|
|
|
'resendUserEmailVerification'])->name('verification.resend'); |
44
|
|
|
|
45
|
|
|
$router->post('api/auth/forgot/password', [\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\ForgotPasswordController::class, |
|
|
|
|
46
|
|
|
'forgotPassword'])->name('forgotPassword'); |
47
|
|
|
|
48
|
|
|
$router->post('api/auth/reset/password', [\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\ResetPasswordController::class, |
|
|
|
|
49
|
|
|
'resetPassword'])->name('resetPassword'); |
50
|
|
|
|
51
|
|
|
$router->post('api/change/password', [\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\ChangePasswordController::class, |
|
|
|
|
52
|
|
|
'changePassword'])->name('changePassword'); |
53
|
|
|
|
54
|
|
|
$router->post('api/edit/profile', [\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\ProfileController::class, |
|
|
|
|
55
|
|
|
'editProfile'])->name('editProfile'); |
56
|
|
|
|
57
|
|
|
$router->post('api/create-two-factor', |
58
|
|
|
[\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\TwoFactorController::class, 'createTwoFactor'])->name('createTwoFactor'); |
|
|
|
|
59
|
|
|
|
60
|
|
|
$router->post('api/confirm-two-factor', |
61
|
|
|
[\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\TwoFactorController::class, 'confirmTwoFactor'])->name('confirmTwoFactor'); |
62
|
|
|
|
63
|
|
|
$router->post('api/disable-two-factor', |
64
|
|
|
[\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\TwoFactorController::class, 'disableTwoFactor'])->name('disableTwoFactor'); |
65
|
|
|
|
66
|
|
|
$router->post('api/current-recovery-codes', |
67
|
|
|
[\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\TwoFactorController::class, 'currentRecoveryCodes'])->name('currentRecoveryCodes'); |
68
|
|
|
|
69
|
|
|
$router->post('api/new-recovery-codes', |
70
|
|
|
[\Ikechukwukalu\Sanctumauthstarter\Tests\Controllers\TwoFactorController::class, 'newRecoveryCodes'])->name('newRecoveryCodes'); |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
protected function getPackageProviders($app): array |
|
|
|
|
74
|
|
|
{ |
75
|
|
|
return [SanctumauthstarterServiceProvider::class, |
76
|
|
|
LocationServiceProvider::class]; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
protected function getEnvironmentSetUp($app) { |
80
|
|
|
$app['config']->set('auth.guards.sanctum', [ |
81
|
|
|
'driver' => 'session', |
82
|
|
|
'provider' => 'users', |
83
|
|
|
]); |
84
|
|
|
} |
85
|
|
|
} |
86
|
|
|
|