Giter Site home page Giter Site logo

unit test to vfsStream about aura.view HOT 5 CLOSED

auraphp avatar auraphp commented on June 9, 2024
unit test to vfsStream

from aura.view.

Comments (5)

harikt avatar harikt commented on June 9, 2024

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.

from aura.view.

pmjones avatar pmjones commented on June 9, 2024

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

from aura.view.

harikt avatar harikt commented on June 9, 2024

great!

from aura.view.

harikt avatar harikt commented on June 9, 2024

@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 :( .

from aura.view.

pmjones avatar pmjones commented on June 9, 2024

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. :-)

from aura.view.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.