<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Thu, 20 Jun 2013 04:32:30 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Sebastian G&ouml;ttschkes' Blog: Using vsfstream (with symfony2)]]></title>
      <guid>http://www.phpdeveloper.org/news/17781</guid>
      <link>http://www.phpdeveloper.org/news/17781</link>
      <description><![CDATA[<p>
In <a href="http://sgoettschkes.blogspot.de/2012/03/using-vsfstream-with-symfony2.html">this recent post</a> <i>Sebastian G&ouml;ttschkes</i> shows how to use the <a href="https://github.com/mikey179/vfsStream">vfsStream</a> stream wrapper in a Symfony2 application to create tests that involve the local file system.
</p>
<blockquote>
I read about <a href="https://github.com/mikey179/vfsStream">vsfstream</a> when skipping through the <a href="http://www.phpunit.de/manual/3.6/en/index.html">phpunit</a> 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).
</blockquote>
<p>
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.
</p>]]></description>
      <pubDate>Thu, 05 Apr 2012 11:32:50 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[VG Tech Blog: Mocking the File System Using PHPUnit and vfsStream]]></title>
      <guid>http://www.phpdeveloper.org/news/17235</guid>
      <link>http://www.phpdeveloper.org/news/17235</link>
      <description><![CDATA[<p>
On the VG Tech blog today there's another post related to unit testing (<a href="http://phpdeveloper.org/news/17229">here's</a> one from before) but this time they're talking about <a href="http://tech.vg.no/2011/03/09/mocking-the-file-system-using-phpunit-and-vfsstream/">mocking the filesystem with vfsStream</a>, a powerful tool that lets you interact with PHP streams as a virtual file system.
</p>
<blockquote>
This article is about how to mock the file system when writing unit tests, and it will be rather code-heavy. [...] <a href="http://phpunit.de/">PHPUnit</a> is the de-facto standard for unit testing in PHP projects, and this is what we will be using together with <a href="http://code.google.com/p/bovigo/wiki/vfsStream">vfsStream</a> in this article.
</blockquote>
<p>
The include the code for a simple storage driver (VGF_Storage_Driver_Filesystem) to use with vfsStream  with "store", "delete" and "get" methods. Also included are examples of using vfsStream to check things like directory existence, if a file exists, or if a file can be read. A few simple assertions are set up in their sample test to check the methods in their "VGF_Storage_Driver_Filesystem" class.
</p>]]></description>
      <pubDate>Fri, 09 Dec 2011 09:40:13 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Lars Tesmer's Blog: How to Unit Test a Class Making Calls to an URL (or the Filesystem) With PHPUnit]]></title>
      <guid>http://www.phpdeveloper.org/news/16889</guid>
      <link>http://www.phpdeveloper.org/news/16889</link>
      <description><![CDATA[<p>
<i>Lars Tesmer</i> has a suggestion for all of the unit testers out there (you do unit test your code, right?) when needing to test a piece of code that makes a call to something on the file system or a remote resource. Their examples come from tests written against the <a href="https://github.com/kriswallsmith/assetic">Assetic</a> codebase.
</p>
<blockquote>
For our most recent <a href="http://lars-tesmer.com/blog/categories/after-work-hacking/">After Work Hacking</a> my co-workers and me decided to write unit tests for the open source project <a href="https://github.com/kriswallsmith/assetic">Assetic</a>. That turned out to be a better decision than our last one, yet we still ran into an interesting challenge.
</blockquote>
<p>
In testing the HttpAsset class from the tool, they came across the problem - a call to a remote/file resource that could not be tested because of a <a href="http://php.net/manual/en/function.file-get-contents.php">file_get_contents</a> call that depends on an external source. They came up with a few options to try to test this example, some better than others:
</p>
<ul>
<li>Give it a real URL to test with
<li>Wrap the file_get_contents inside of a new class (ex. a "ContentFetcher")
<li>Use <a href="https://github.com/mikey179/vfsStream">vfsStream</a> to mock out the file system in the unit test
</ul>
<p>
In their case, vfsStream couldn't be used due to how the fetch call was made, but the tool can be very handy if you need to mock out an external file system resource.
</p>]]></description>
      <pubDate>Wed, 21 Sep 2011 12:04:47 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Stubbles Blog: vfsStream 0.1.0 Released]]></title>
      <guid>http://www.phpdeveloper.org/news/9320</guid>
      <link>http://www.phpdeveloper.org/news/9320</link>
      <description><![CDATA[<p>
On the Stubbles blog, <i>Frank Kleine</i> has <a href="http://www.stubbles.org/archives/36-vfsStream-0.1.0-released.html">posted about</a> the release of a new wrapper class he's developed to go around a virtual file system.
</p> 
<blockquote>
Some minutes ago I released the first version of <a href="http://www.stubbles.org/exit.php?url_id=245&entry_id=36">vfsStream</a>. vfsStream is a stream wrapper for a virtual file system that may be helpful in unit tests to mock the real file system. It can be used with any unit test framework, like <a href="http://phpunit.de">PHPUnit</a> or <a href="http://simpletest.org/">SimpleTest</a>.
</blockquote>
<p>
The idea for the class came about when he thought about the use of real databases vs test databases and applied it to file systems. You can grab the latest version from their <a href="http://stubbles.net/wiki/vfsStream">trac website</a> as well as get more information about known issues and a brief example of its use.
</p>]]></description>
      <pubDate>Thu, 27 Dec 2007 11:11:00 -0600</pubDate>
    </item>
  </channel>
</rss>
