Skip to content

[13.x] Add assertEmpty to the Storage facade#60658

Draft
jackbayliss wants to merge 1 commit into
laravel:13.xfrom
jackbayliss:add-assert-empty-to-storage-facade
Draft

[13.x] Add assertEmpty to the Storage facade#60658
jackbayliss wants to merge 1 commit into
laravel:13.xfrom
jackbayliss:add-assert-empty-to-storage-facade

Conversation

@jackbayliss

@jackbayliss jackbayliss commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Currently, asserting the whole disk is empty requires passing an empty string to assertDirectoryEmpty which reads oddly / feels a bit like a hack.

This PR adds an assertEmpty method, which is fully recursive, so it fails if a file exists anywhere on the disk.

Storage::fake('some-specific');

// Tests....


// Before
Storage::assertDirectoryEmpty(''); // wut wut?!

// After
Storage::assertEmpty();

We have a lot of tests that set specific disks up, and we need to make sure they're empty ie certain files are moved / deleted etc via jobs, commands, etc...

I can macro it worst case, but feels like something everyone may benefit from.

Perhaps you prefer assertDiskEmpty - so open to changing!

@github-actions

github-actions Bot commented Jul 3, 2026

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.

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.

1 participant