Skip to content

Commit eaa27c9

Browse files
committed
Improve test
1 parent 384d719 commit eaa27c9

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tests/VeryBasicAuthTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,16 +192,17 @@
192192
// Create a fresh .env
193193
file_put_contents($envPath, "APP_NAME=Laravel\nBASIC_AUTH_PASSWORD=test");
194194

195-
$password = 'newpassword123';
195+
$password = 'password' . uniqid();
196196

197197
// Simulate user input for the console command
198198
$this->artisan('very-basic-auth:password-generate')
199199
->expectsQuestion('Please enter a password for the very basic auth', $password)
200200
->expectsQuestion('Please confirm your password', $password)
201201
->assertExitCode(0);
202202

203-
// Load and parse the .env file to get the new hash via Laravels env helper
204-
$hashedPassword = env('BASIC_AUTH_PASSWORD');
203+
// Reload env-variables to make sure the newest value is available
204+
$this->artisan('config:cache');
205+
$hashedPassword = config('very_basic_auth.password');
205206

206207
expect($hashedPassword)->not->toBeNull();
207208
expect(app()->make('hash')->check($password, $hashedPassword))->toBeTrue();

0 commit comments

Comments
 (0)