webmozarts / glob

A PHP implementation of Ant's glob.
MIT License
254 stars 16 forks source link

streamwrapper support for Glob #3

Closed michielroding closed 9 years ago

michielroding commented 9 years ago

I have a backuptool that uses a directory structure to store files, e.g.:

/my/path/to/backupfiles/year/month/day/filename.ext

I'd like to unittest my code, so I'm looking into e.g. vfsStream to emulate the expected (and unexpected) structure.

I generate a glob pattern somewhere that is used to find files relating to certain servers, backup types (sql/files/etc) etc. php's glob() works fine in production but doesn't work well with vfsStream; webmozart\glob looks promising but doesn't work well with streamwrappers such as vfsStream.

I found Path::isAbsolute() to be the culprit; if I simply return true, the code works fine otherwise.

webmozart commented 9 years ago

We can't change isAbsolute() to return true - that would be wrong, as a URI is not an absolute path. We could however change Glob to support both absolute paths and URIs, which would solve your problem - right?

michielroding commented 9 years ago

Yes it would!

webmozart commented 9 years ago

Stream wrapper support is in 2.0-dev now.

michielroding commented 9 years ago

Thanks! I'll try it out asap.