mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-16 18:31:49 +01:00
in memory db for testing
This commit is contained in:
parent
67288ab815
commit
dcf3e6e1a0
40
.env.testing
Normal file
40
.env.testing
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
APP_NAME=2FAuth
|
||||||
|
APP_ENV=testing
|
||||||
|
APP_KEY=base64:pdjaSqs7dDu8SdYCQzsayBAqeMC+85fmo3bpeBCCT94=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
LOG_CHANNEL=stack
|
||||||
|
|
||||||
|
DB_CONNECTION=testing
|
||||||
|
DB_DATABASE=:memory:
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=array
|
||||||
|
QUEUE_CONNECTION=sync
|
||||||
|
SESSION_DRIVER=array
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
REDIS_HOST=127.0.0.1
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_DRIVER=smtp
|
||||||
|
MAIL_HOST=smtp.mailtrap.io
|
||||||
|
MAIL_PORT=2525
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
|
||||||
|
PUSHER_APP_ID=
|
||||||
|
PUSHER_APP_KEY=
|
||||||
|
PUSHER_APP_SECRET=
|
||||||
|
PUSHER_APP_CLUSTER=mt1
|
||||||
|
|
||||||
|
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||||
|
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
@ -1,7 +1,7 @@
|
|||||||
APP_ENV=testing
|
APP_ENV=testing
|
||||||
APP_KEY=
|
APP_KEY=
|
||||||
|
|
||||||
DB_CONNECTION=sqlite
|
DB_CONNECTION=testing
|
||||||
DB_DATABASE=:memory:
|
DB_DATABASE=:memory:
|
||||||
|
|
||||||
CACHE_DRIVER=array
|
CACHE_DRIVER=array
|
||||||
|
@ -8,8 +8,6 @@ before_script:
|
|||||||
- composer self-update
|
- composer self-update
|
||||||
- composer install --no-interaction
|
- composer install --no-interaction
|
||||||
- php artisan key:generate
|
- php artisan key:generate
|
||||||
- php artisan migrate --seed
|
|
||||||
- php artisan passport:install
|
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- vendor/bin/phpunit
|
- vendor/bin/phpunit
|
@ -43,6 +43,13 @@
|
|||||||
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'testing' => [
|
||||||
|
'driver' => 'sqlite',
|
||||||
|
'database' => ':memory:',
|
||||||
|
'prefix' => '',
|
||||||
|
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
||||||
|
],
|
||||||
|
|
||||||
'mysql' => [
|
'mysql' => [
|
||||||
'driver' => 'mysql',
|
'driver' => 'mysql',
|
||||||
'url' => env('DATABASE_URL'),
|
'url' => env('DATABASE_URL'),
|
||||||
|
@ -3,12 +3,32 @@
|
|||||||
namespace Tests\Unit;
|
namespace Tests\Unit;
|
||||||
|
|
||||||
use Tests\TestCase;
|
use Tests\TestCase;
|
||||||
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Illuminate\Foundation\Testing\WithFaker;
|
use Illuminate\Foundation\Testing\WithFaker;
|
||||||
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
use Illuminate\Auth\Authenticatable;
|
use Illuminate\Auth\Authenticatable;
|
||||||
|
|
||||||
class APITest extends TestCase
|
class APITest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rollback and execute migrations for each test.
|
||||||
|
*/
|
||||||
|
use DatabaseTransactions;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set up fresh db
|
||||||
|
*/
|
||||||
|
public function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
// Artisan::call('make:migrate', ['--force' => true]);
|
||||||
|
Artisan::call('migrate', ['--seed' => true]);
|
||||||
|
Artisan::call('passport:install',['--verbose' => 2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* test User creation via API
|
* test User creation via API
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user