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

Add directory assertions. #1154

Closed
wants to merge 2 commits into from

Conversation

klaude
Copy link

@klaude klaude commented Feb 24, 2014

Add the following assertions:

  • assertDirectoryExists()
  • assertDirectoryNotExists()
  • assertDirectoryCount()
  • assertDirectoryEmpty()
  • assertDirectoryNotEmpty()

I was working with directory processing for a project at work, and figured these assertions may come in handy. I think I've followed the conventions present in the existing code, though I've left @since docblock tags out since I don't know which version it'd go into, provided it's merged. Thanks!

@whatthejeff
Copy link
Contributor

Some of this functionality was suggested previously and rejected (see #179).

I appreciate the time and effort, but I'd prefer not to add yet another assertion to PHPUnit core. This is a rather large PR and there is a real cost to increasing the amount of code and documentation that needs to be maintained for new features.

I think PHPUnit does a decent job at providing a handful of simple, useful assertions that can be leveraged to build more complex, custom assertions, if necessary. At this point, though, I'd much rather see new assertions packaged as 3rd-party plugins.

@glensc
Copy link

glensc commented Mar 16, 2020

I think the methods got implemented now (4.8.36, I think) throws me this kind of error:

 PHP Fatal error:  Cannot make static method PHPUnit_Framework_Assert::assertDirectoryExists() non static in class TempDirTest in /builds/yUZXfEGB/0/d1/libraries/fileutil/tests/TempDirTest.php on line 96

@glensc
Copy link

glensc commented Mar 16, 2020

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.

3 participants