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

unit test to vfsStream #8

Closed
harikt opened this issue Jul 25, 2012 · 5 comments
Closed

unit test to vfsStream #8

harikt opened this issue Jul 25, 2012 · 5 comments
Assignees
Milestone

Comments

@harikt
Copy link
Member

harikt commented Jul 25, 2012

Try changing the unit tests to make use of https://github.com/mikey179/vfsStream .

So we don't need to worry about the file system and permissions of directory system.

@ghost ghost assigned harikt Jul 25, 2012
@harikt
Copy link
Member Author

harikt commented Nov 18, 2012

vfsstream will not work with getRealPath()

https://github.com/mikey179/vfsStream/wiki/Known-Issues

Or we want to change the implementation at

https://github.com/auraphp/Aura.View/blob/master/src/Aura/View/TemplateFinder.php#L198

to something like is_readable($file) .

But that doesn't fix everything.

More troubles like creating mockobject for fetch() .

To further proceed I need some help how to make this happen.

@pmjones
Copy link
Member

pmjones commented Nov 18, 2012

We'll make this the very next priority, then. All the other packages seem OK now. :-)

@harikt
Copy link
Member Author

harikt commented Nov 18, 2012

great!

@harikt
Copy link
Member Author

harikt commented Nov 19, 2012

@pmjones we can get the file contents of vfsstream via

file_get_contents(vfsStream::url('root/tmp/foo/inner_view.php'))

or via

$this->root->getChild('tmp/foo/inner_view.php')->getContent()

bovigo/vfsStream#48 (comment)

May be we need to change the fetch method to

public function fetch($__name__)
{
    $file = $this->find($__name__);
    return file_get_contents($file);
}

or it seems a good idea to create a MockObject for the fetch method and return the content? I am not sure :( .

@pmjones
Copy link
Member

pmjones commented Nov 19, 2012

Turned out that switching to "is_readable()" was the key, as you suggested @harikt . The change is made, the tests are converted to VfsStream, and life is good. :-)

@pmjones pmjones closed this as completed Nov 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants