Articles

Showing 6 posts
February 1st, 2025

Mocking IP Addresses in Laravel for Testing

When it comes to testing anything that stores IP addresses in Laravel, you may want to mock the return value of request()->ip() to verify that something has been stored correctly, etc.

Author
Alex Garrett-Smith
Testing
Laravel
December 19th, 2024

Mocking Authenticated Users in Laravel's Request

I recently found myself writing a test where I needed to test a macro applied to the Request object in Laravel. But I needed the user to be 'authenticated'.

Author
Alex Garrett-Smith
Laravel
Testing
December 16th, 2024

The Two Main Culprits for Your Laravel Dusk Tests Not Running

Despite Dusk integrating flawlessly with the Laravel framework, sometimes your tests just won't run.

Author
Alex Garrett-Smith
Testing
Laravel
October 15th, 2024

Disable Vite During Laravel Tests

Unless you're running end-to-end tests, you probably don't need Vite to build assets before your test suite runs.

Author
Alex Garrett-Smith
Testing
Laravel
Inertia
September 18th, 2024

Running Laravel Dusk on GitHub Actions

Without wasting time, this article will have you set up and running your Dusk test suite on GitHub Actions. We'll also discuss security around any secret keys you may need. Let's take a look.

Author
Alex Garrett-Smith
Laravel
Testing
May 24th, 2024

How to Assert Element Count With Laravel Dusk

While Dusk doesn't provide a direct assertion method to check the count of elements on a page, we can still fetch all elements by a selector and then make an assertion on what's returned.

Author
Alex Garrett-Smith
Testing
Laravel

Tags