News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sebastian Göttschkes' Blog:
Using vsfstream (with symfony2)
April 05, 2012 @ 11:32:50

In this recent post Sebastian Göttschkes shows how to use the vfsStream stream wrapper in a Symfony2 application to create tests that involve the local file system.

I read about vsfstream when skipping through the phpunit docs. Back then, I decided I don't need a virtual file system. Some time later, I had to test classes which read and write files and found myself creating and deleting temporary folders, messing around with nasty errors (like my favourite one where for some reasons tests fail when I don't use @runTestsInSeparateProcesses).

He walks you through the install process, how to register it in the Symfony2 autoloader (so you don't have to include the files each time) and how to include it (via namespace-based loading) in your tests.

0 comments voice your opinion now!
vfsstream symfony2 tutorial filesystem unittest phpunit


blog comments powered by Disqus

Similar Posts

Chris Renner's Blog: Gerrymandered Code: Extending Zend_Registry to globalize session vars

Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 12)

Jeremy Cook's Blog: Making PHPUnit, Doctrine & MySQL Play Nicely

PHPFreaks.com: Working with checkboxes and a database

Cormac's Blog: Fast server-side rejection of large image uploads using $_FILES


Community Events





Don't see your event here?
Let us know!


install series interview opinion framework voicesoftheelephpant deployment introduction package bugfix tips list api release laravel podcast language community library symfony

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework