Skip to content

[13.x] Ensure assertModelMissing and assertModelExists dont silently pass#59772

Merged
taylorotwell merged 3 commits intolaravel:13.xfrom
jackbayliss:13.x-fix-assert-db-has-doesnthavee
Apr 20, 2026
Merged

[13.x] Ensure assertModelMissing and assertModelExists dont silently pass#59772
taylorotwell merged 3 commits intolaravel:13.xfrom
jackbayliss:13.x-fix-assert-db-has-doesnthavee

Conversation

@jackbayliss
Copy link
Copy Markdown
Contributor

@jackbayliss jackbayliss commented Apr 19, 2026

Noticed I missed checking its not an empty array because... https://3v4l.org/qKWot#v8.5.3 is true

 // Currently this would pass, even tho it shouldnt :o 
 $user = User::factory()->create();                                                                                                                                                                      
 $this->assertModelMissing($user);

I've also added some tests to ensure it never catches a poor soul again. As these weren't tested afaik!

hyb

@github-actions
Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@jackbayliss jackbayliss changed the title [13.x] Ensure assertDatabaseHas and assertDatabaseMissing dont silently pass [13.x] Ensure assertModelMissing and assertModelExists dont silently pass Apr 19, 2026
@jackbayliss jackbayliss marked this pull request as ready for review April 19, 2026 16:16
@taylorotwell taylorotwell merged commit 1f42653 into laravel:13.x Apr 20, 2026
52 checks passed
@jackbayliss jackbayliss deleted the 13.x-fix-assert-db-has-doesnthavee branch April 20, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants