<?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>Wed, 23 May 2012 10:48:04 -0500</pubDate>
    <ttl>30</ttl>
    <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>
  </channel>
</rss>

