Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Example test fails after artisan optimize has been run #1359

Open
jpmorby opened this issue Feb 26, 2025 · 0 comments
Open

[Bug]: Example test fails after artisan optimize has been run #1359

jpmorby opened this issue Feb 26, 2025 · 0 comments
Labels

Comments

@jpmorby
Copy link

jpmorby commented Feb 26, 2025

What Happened

Now this might be an expected fact, I'm kinda new to all of this .. but after running php artisan optimize running pest fails as follows

FAIL Tests\Feature\Auth\AuthenticationTest
✓ login screen can be rendered 0.27s
✓ users can authenticate using the login screen 0.99s
✓ users can not authenticate with invalid password 0.10s
⨯ users can logout

How to Reproduce

php artisan optimize
./vendor/bin/pest --ci

results in

FAILED Tests\Feature\Auth\AuthenticationTest > users can logout
The user is authenticated
Failed asserting that true is false.

at tests/Feature/Auth/AuthenticationTest.php:45
41▕ $user = User::factory()->create();
42▕
43▕ $response = $this->actingAs($user)->post('/logout');
44▕
➜ 45▕ $this->assertGuest();
46▕ $response->assertRedirect('/');
47▕ });

Tests: 1 failed, 26 passed (59 assertions)
Duration: 5.87s

php artisan optimize:clear
./vendor/bin/pest --ci

PASS Tests\Feature\Auth\AuthenticationTest
✓ login screen can be rendered 0.13s
✓ users can authenticate using the login screen 0.37s
✓ users can not authenticate with invalid password 0.09s
✓ users can logout 0.01s

Sample Repository

No response

Pest Version

3.7.4

PHP Version

8.4.4

Operation System

macOS

Notes

This is on Laravel 12.0.1

As a secondary note, the .gitlab-ci.yml on the Pest home page doesn't work ... I do now have a working one which I'd be happy to share (the cache entries don't cache the vendor folder, so there is no ./vendor/bin/pest after the build) - my updated version (with additional laravel specific bits) does work however

@jpmorby jpmorby added the bug label Feb 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant