Skip to content

About

Explains why Laravel `whereFulltext` fails in tests with `RefreshDatabase` and shows a clean, testable workaround using repository abstraction and mocking.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

Hidden Issue with whereFulltext and RefreshDatabase in Laravel

Hidden Issue with whereFulltext and RefreshDatabase in Laravel

Overview

This article explores a hidden issue when using Laravel's whereFulltext method in tests that utilize the RefreshDatabase trait. Since MySQL does not support FULLTEXT indexes within transactions, RefreshDatabase causes tests relying on whereFulltext to return empty results. The article provides a detailed explanation of the issue and presents practical solutions, including committing transactions manually and using dependency injection with a search repository.

📎 Read Full

Hidden Issue with whereFulltext and RefreshDatabase in Laravel

About

Explains why Laravel `whereFulltext` fails in tests with `RefreshDatabase` and shows a clean, testable workaround using repository abstraction and mocking.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Contributors