<?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>Mon, 20 May 2013 08:35:31 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[DZone.com: PHPUnit vs. Phake cheatsheet]]></title>
      <guid>http://www.phpdeveloper.org/news/19483</guid>
      <link>http://www.phpdeveloper.org/news/19483</link>
      <description><![CDATA[<p>
On DZone.com today <i>Giorgio Sironi</i> has posted a "cheat sheet" to help you correlate the functionality of two PHP unit testing tools - <a href="http://css.dzone.com/articles/phpunit-vs-phake-cheatsheet">PHPUnit vs Phake</a> (for mocking objects).
</p>
<blockquote>
Benjamin Eberlei introduced me to Phake with his recent article: it is a Composer-ready PHP library that integrates easily with PHPUnit and provides an independent Test Doubles framework, capable of producing Stubs, Mocks, and Spies. The syntax and object model reminds me of Mockito, the Java Test Double framework from the authors of Growing Object-Oriented Software. I like tools that do one thing and do it well, and after experimenting with Phake I'm using it on all new code. 
</blockquote>
<p>
He compares the two tools on a few different pieces of functionality including creating stubs, mocks and spies. Sample code is included for both sides. It's not a detailed guide by any means, but it can give you a better picture of how the two compare.
</p>
Link: http://css.dzone.com/articles/phpunit-vs-phake-cheatsheet]]></description>
      <pubDate>Fri, 19 Apr 2013 09:53:45 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[ZendCasts.com: PHAR Out Autoloading]]></title>
      <guid>http://www.phpdeveloper.org/news/16982</guid>
      <link>http://www.phpdeveloper.org/news/16982</link>
      <description><![CDATA[<p>
On the ZendCasts.com site there's a new screencast posted looking at <a href="http://www.zendcasts.com/phar-out-autoloading-hd/2011/10/">autoloading in phar</a>, the <a href="http://php.net/phar">packaging tool</a> built into PHP.  This is a continuation of the series started <a href="http://www.zendcasts.com/fun-with-phar/2011/10/">here</a>.
</p>
<p>
Building on the foundation from the <a href="http://www.zendcasts.com/fun-with-phar/2011/10/">previous screencast</a>, he shows how to enhance it and allow it to autoload based on an autoloader defined in a "stub.php" file.
</p>
<p>
You can grab the complete source for this screencast <a href="https://gist.github.com/1276774">over on github</a>.
</p>]]></description>
      <pubDate>Wed, 12 Oct 2011 09:13:35 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: Stubbing Hard-Coded Dependencies]]></title>
      <guid>http://www.phpdeveloper.org/news/14034</guid>
      <link>http://www.phpdeveloper.org/news/14034</link>
      <description><![CDATA[<p>
<i>Sebastian Bergmann</i> has a new post to his blog (part of a series on testing techniques for testing that difficult code) about the hard-coded dependencies required by your code and <a href="http://sebastian-bergmann.de/archives/885-Stubbing-Hard-Coded-Dependencies.html">how to stub them for easier testing</a>.
</p>
<blockquote>
A mock object can be used anywhere in the program where the program expects an object of the mocked class. However, this only works as long as the object can be passed into the context where the original object is used.
</blockquote>
<p>
Ideally this wouldn't be a problem - handled correctly, dependency injection would make it a non-issue. But, because it has been known to happen, <a href="http://phpunit.de">PHPUnit</a> gives you the ability, via the set_new_overload method, to capture that object definition and mock it with a reference to another method in the test class.
</p>]]></description>
      <pubDate>Tue, 16 Feb 2010 11:55:51 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: Sharing Fixtures and Stubbing/Mocking Static Methods]]></title>
      <guid>http://www.phpdeveloper.org/news/14028</guid>
      <link>http://www.phpdeveloper.org/news/14028</link>
      <description><![CDATA[<p>
<i>Sebastian Bergmann</i> has two recent posts dealing with some of the more difficult topics in unit testing. One looks at <a href="http://sebastian-bergmann.de/archives/884-Sharing-Fixture-Between-Tests.html">sharing fixtures between tests</a> and the other talks about <a href="http://sebastian-bergmann.de/archives/883-Stubbing-and-Mocking-Static-Methods.html">stubbing and mocking static methods</a> in your tests.
</p>
<p>From the <a href="http://sebastian-bergmann.de/archives/884-Sharing-Fixture-Between-Tests.html">first of the two tutorials</a>:
<blockquote>
A good example of a fixture that makes sense to share across several tests is a database connection: you log into the database once and reuse the database connection instead of creating a new connection for each test. This makes your tests run faster.
</blockquote>
<p>
This fixture sharing example uses the setUpBeforeClass and tearDownAfterClass methods to create and destroy the connection.
</p>
<p>
In <a href="http://sebastian-bergmann.de/archives/883-Stubbing-and-Mocking-Static-Methods.html">the second article</a> <i>Sebastian</i> shows how to mock up a sample static function and mock it with the "staticExpects" helper.
</p>]]></description>
      <pubDate>Mon, 15 Feb 2010 12:55:49 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Padraic Brady's Blog: The Mockery: An Independent Mock Object and Stub Framework for PHP5]]></title>
      <guid>http://www.phpdeveloper.org/news/12080</guid>
      <link>http://www.phpdeveloper.org/news/12080</link>
      <description><![CDATA[<p>
Noting the lack of a good, independent library for creating Mock Objects for unit testing PHP scripts, <i>Padraic Brady</i> (with assistance from <i>Travis Swicegood</i>) has come up with a standalone Mock Object and Stub framework - <a href="http://blog.astrumfutura.com/archives/392-The-Mockery-An-Independent-Mock-Object-and-Stub-Framework-for-PHP5.html">Mockery</a>.
</p>
<blockquote>
It's not tailored specifically to any one testing framework, rather it's an entirely separate framework with a discrete API. The idea is that you can use this framework within PHPUnit, or SimpleTest, or anything else really, without being forced to rely on the built-in support (if any) that test framework provides. Mockery was designed specifically to implement a form of Domain Specific Language (DSL). It makes extensive use of a fluent interface mixed with methods to approximate plain English.
</blockquote>
<p>
He includes an overview of what Mock Objects and Stubs are and how to set them up with the Mockery tool. He finishes things off with a look at the Mockery and Mock Object Expectation APIs. You can grab this first release either as a <a href="http://dev.phpspec.org/Mockery-0.1.0alpha.tgz">PEAR package</a> or from its <a href="http://github.com/padraic/mockery">github page</a>.
</p>]]></description>
      <pubDate>Fri, 06 Mar 2009 10:28:58 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[PHP-GTK Community Site: Enabling code completion for PHP-GTK in your PHP IDE]]></title>
      <guid>http://www.phpdeveloper.org/news/10390</guid>
      <link>http://www.phpdeveloper.org/news/10390</link>
      <description><![CDATA[<p>
The PHP-GTK Community Site has <a href="http://php-gtk.eu/enabling-code-completion-for-phpgtk-in-your-php-ide">posted some information</a> (and some files) to help make your editor of choice a bit more "PHP-GTK aware" when it comes to code completion.
</p>
<blockquote>
These IDEs are able to provide code completion not only for prebuilt extension code, but also for user-level PHP code. This gives us a way to provide it to PHP-GTK developers : all it takes is a "stub" file containing PHP declarations equivalent to the PHP-GTK2 classes, interfaces, and their methods and constants.
</blockquote>
<p>
Making it by hand would be slow (and not efficient at all) so they opted to let the <a href="http://www.php.net/manual/en/language.oop5.reflection.php#language.oop5.reflection.reflector">Reflection</a> API do the heavy lifting for them and generate a Gtk_Dumper output file to hand to your editor and let it parse. The file is <a href="http://php-gtk.eu/sites/php-gtk.eu/files/Gtk_Dumper.php.txt">available for download</a>.
</p>]]></description>
      <pubDate>Wed, 11 Jun 2008 12:04:59 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Padraic Brady's Blog: Mocks, Stubs, And SimpleTest Wins]]></title>
      <guid>http://www.phpdeveloper.org/news/9016</guid>
      <link>http://www.phpdeveloper.org/news/9016</link>
      <description><![CDATA[<p>
In a new post today, <i>Padraic Brady</i> <a href="http://blog.astrumfutura.com/archives/317-Mocks,-Stubs,-And-SimpleTest-Wins.html">talks about</a> some of his experience with unit testing in PHP - specifically with two of the more popular testing applications - SimpleTest and PHPUnit.
</p>
<blockquote>
The word is that SimpleTest is moving towards PHP5 in the near future which is great news for all Mockists in PHP. When I moved to PHP, SimpleTest became the main ingredient in many a coding session up to 2 in the morning but once PHP5 gained traction and I was seduced into leaving PHP4 behind I found myself relying more heavily on PHPUnit. Not that SimpleTest is anti-PHP5 in any way (only some small things and obviously E_STRICT giving it a heart attack), but more projects I didn't control leaned heavily towards PHPUnit once PHP5 took off.
</blockquote>
<p>
He goes on to talk about some of the <a href="http://blog.astrumfutura.com/archives/317-Mocks,-Stubs,-And-SimpleTest-Wins.html">differences between the two</a> pieces of software (including Mock Object support and Stubs) and his personal feelings on how each of them works in his development experience. His interest has leaned more towards needing the Mock objects, though, so he favors SimpleTest for doing just what he needs.
</p>]]></description>
      <pubDate>Mon, 12 Nov 2007 08:49:00 -0600</pubDate>
    </item>
  </channel>
</rss>
