dg / bypass-finals

Removes `final` and `readonly` keywords from source code on-the-fly and allows mocking of final methods and classes. It can be used together with any test tool such as PHPUnit or Mockery.
Other
487 stars 30 forks source link

`mkdir` method always uses non-recursive flag #8

Closed romm closed 5 years ago

romm commented 5 years ago

The third parameter of mkdir is a boolean which indicates if the given folder path should be created recursively.

However, false is always given; so when some API tries to create a full path, it fails.

https://github.com/dg/bypass-finals/blob/06d98c87299ce5fa6b0fc709cabdfa7ca2d04576/src/BypassFinals.php#L54-L57


My usecase is: I want to use Infection which needs to have access to PHPUnit's coverage files, which are created in a folder (which is itself created with the recursive parameter set to true); see php-code-coverage Facade file.

So when I try to run Infection, the coverage files creation fails because the folders can't be created.


I tried to look what value is given to the $options parameters of the method above. Documentation says it can contain STREAM_MKDIR_RECURSIVE, which would be a solution.

In my case it contains 9 which seems to be the equivalent of STREAM_NOTIFY_FAILURE.

I don't know how to fix it with these information, any idea? 🙂

romm commented 5 years ago

That was fast!

Thanks a lot, it works like a charm. 😄

dg commented 5 years ago

Your're welcome :)