Skip to content

Commit 00c04bf

Browse files
fix: testing feature
1 parent 21490f9 commit 00c04bf

26 files changed

+75
-59
lines changed

.env.example

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
APP_NAME=LaravelInertiaVueSpa
2-
APP_ENV=local
2+
APP_ENV=local ## or 'testing'
33
APP_KEY=
44
APP_DEBUG=true
55
APP_URL=http://localhost
@@ -8,13 +8,17 @@ LOG_CHANNEL=stack
88
LOG_DEPRECATIONS_CHANNEL=null
99
LOG_LEVEL=debug
1010

11+
# use this for docker
1112
DB_CONNECTION=mysql
12-
DB_HOST=mysql
13-
DB_PORT=3306
13+
DB_HOST=mysql
14+
DB_PORT=3306
1415
DB_DATABASE=LaravelInertiaVueSpa.Database_2024!
15-
DB_USERNAME=root
16+
DB_USERNAME=root
1617
DB_PASSWORD=LaravelInertiaVueSpa.Password_2024!
1718

19+
# modify this for sqlite
20+
# DB_DATABASE=/home/${yourusername}/${path}/database/database.sqlite
21+
1822
BROADCAST_DRIVER=log
1923
CACHE_DRIVER=file
2024
FILESYSTEM_DISK=local
@@ -55,4 +59,4 @@ VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
5559
VITE_PUSHER_HOST="${PUSHER_HOST}"
5660
VITE_PUSHER_PORT="${PUSHER_PORT}"
5761
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
58-
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
62+
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

.github/workflows/phpunit_action.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,38 @@ jobs:
1010
project-tests:
1111

1212
runs-on: ubuntu-latest
13-
13+
1414
steps:
1515
- uses: actions/checkout@v2
16-
16+
1717
- name: Copy .env
1818
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
19-
19+
2020
- name: Update Dependencies (if needed)
2121
run: composer update --no-ansi --no-interaction --no-scripts --no-progress
22-
22+
2323
- name: Install Dependencies
2424
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress
25-
25+
2626
- name: Generate key
2727
run: php artisan key:generate
28-
28+
2929
- name: Directory Permissions
3030
run: chmod -R 777 storage bootstrap/cache
31-
31+
3232
- name: Create Database
3333
run: |
3434
mkdir -p database
35-
touch database/database.sqlite
36-
35+
[ -f database/database.sqlite ] || touch database/database.sqlite
36+
3737
- name: Build assets for development
3838
env:
3939
LARAVEL_BYPASS_ENV_CHECK: 1
4040
run: npm install && npm run dev &
41-
41+
4242
- name: Wait for server to start
43-
run: sleep 10s
44-
43+
run: sleep 10s
44+
4545
- name: Execute tests (Unit and Feature tests) via PHPUnit
4646
env:
4747
DB_CONNECTION: sqlite

bootstrap/cache/.gitignore

100644100755
File mode changed.

config/database.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
|
1616
*/
1717

18-
'default' => env('DB_CONNECTION', 'mysql'),
18+
'default' => env('DB_CONNECTION', 'sqlite'),
1919

2020
/*
2121
|--------------------------------------------------------------------------
@@ -38,7 +38,7 @@
3838
'sqlite' => [
3939
'driver' => 'sqlite',
4040
'url' => env('DATABASE_URL'),
41-
'database' => env('DB_DATABASE', database_path('database.sqlite')),
41+
'database' => dirname(__DIR__).'/database/database.sqlite',
4242
'prefix' => '',
4343
'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
4444
],

config/queue.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686

8787
'failed' => [
8888
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
89-
'database' => env('DB_CONNECTION', 'mysql'),
89+
'database' => env('DB_CONNECTION', 'sqlite'),
9090
'table' => 'failed_jobs',
9191
],
9292

database/factories/UserFactory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function definition(): array
2828
'name' => $this->faker->name(),
2929
'email' => $this->faker->unique()->safeEmail(),
3030
'email_verified_at' => now(),
31-
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
31+
'password' => $this->faker->password(8),
3232
'two_factor_secret' => null,
3333
'two_factor_recovery_codes' => null,
3434
'remember_token' => Str::random(10),

phpunit.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
<directory suffix="Test.php">./tests/Feature</directory>
99
</testsuite>
1010
</testsuites>
11-
<php>
12-
<env name="APP_ENV" value="testing"/>
11+
<env name="APP_ENV" value="testing" force="true" />
1312
<env name="BCRYPT_ROUNDS" value="4"/>
1413
<env name="CACHE_DRIVER" value="array"/>
1514
<env name="DB_CONNECTION" value="sqlite"/>
@@ -18,7 +17,6 @@
1817
<env name="QUEUE_CONNECTION" value="sync"/>
1918
<env name="SESSION_DRIVER" value="array"/>
2019
<env name="TELESCOPE_ENABLED" value="false"/>
21-
</php>
2220
<source>
2321
<include>
2422
<directory suffix=".php">./app</directory>

storage/app/.gitignore

100644100755
File mode changed.

storage/app/public/.gitignore

100644100755
File mode changed.

storage/framework/.gitignore

100644100755
File mode changed.

0 commit comments

Comments
 (0)