<?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, 23 May 2013 02:06:43 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[NetTuts.com: Expressive Tests with Hamcrest]]></title>
      <guid>http://www.phpdeveloper.org/news/18855</guid>
      <link>http://www.phpdeveloper.org/news/18855</link>
      <description><![CDATA[<p>
On the NetTuts.com site today there's a new tutorial introducing <a href="http://net.tutsplus.com/articles/news/expressive-tests-with-hamcrest/">the Hamcrest validation matchers</a> and how to use them in your PHPUnit testing to enhance both the readability and functionality of the assertions.
</p>
<blockquote>
Hamcrest is a set of matchers for writing more expressive code. It just so happens that these matchers are especially useful when writing tests. In this article, we'll look at <a href="http://code.google.com/p/hamcrest/">Hamcrest</a> for PHP. [...] Hamcret's expressiveness originated with JMock, but it wasn't until the addition of the unique assertThat() method that it was refactored into a self-contained library and independently usable in testing frameworks.
</blockquote>
<p>
He talks about the "generations" of unit testing tools, a division based on their assertion functionality - simple, exact or using matchers. Installation instructions via PEAR are included (though there's also <a href="https://packagist.org/packages/davedevelopment/hamcrest-php">a composer package</a> for it too) as well as code for an example test. More samples are given for comparing things like numeric values, strings and setting up inclusions and exclusions with the anyOf/noneOf matchers.
</p>]]></description>
      <pubDate>Thu, 06 Dec 2012 12:25:12 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: Getting Started with Hamcrest]]></title>
      <guid>http://www.phpdeveloper.org/news/9384</guid>
      <link>http://www.phpdeveloper.org/news/9384</link>
      <description><![CDATA[<p>
Following up on the <a href="http://www.phpdeveloper.org/news/9337">start of his port</a> of the Hamcrest (a library of "matchers") functionality over to PHP, <i>Sebastian Bergmann</i> has posted <a href="http://sebastian-bergmann.de/archives/735-Getting-Started-with-Hamcrest.html">the getting started guide</a> to show you how to use it with the popular <a href="http://www.phpunit.de/">PHPUnit</a> unit testing software.
</p>
<blockquote>
There are a number of situations where matchers are invaluble, such as UI validation, or data filtering, but it is in the area of writing flexible tests that matchers are most commonly used.
</blockquote>
<p>
His <a href="http://sebastian-bergmann.de/archives/735-Getting-Started-with-Hamcrest.html">example</a> that checks to see if one object is equal to another object. The Hamcrest matcher allows for a "assertThat" method making it easier to create and use pre-existing unit testing assertions.
</p>
<p>
He also includes a list of some of the most common matchers broken up into groups of core, logical, object, number and text.
</p>]]></description>
      <pubDate>Wed, 09 Jan 2008 10:23:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: Hamcrest]]></title>
      <guid>http://www.phpdeveloper.org/news/9337</guid>
      <link>http://www.phpdeveloper.org/news/9337</link>
      <description><![CDATA[<p>
In a <a href="http://sebastian-bergmann.de/archives/733-Hamcrest.html">new post</a> to his blog, <i>Sebastian Bergmann</i> mentions a new effort he's undertaken - the porting of the <a href="http://code.google.com/p/hamcrest/">Hamcrest</a> library of matcher objects to PHP.
</p>
<blockquote>
I have begun to port <a href="http://code.google.com/p/hamcrest/">Hamcrest</a>, which provides a library of matcher objects (also known as constraints or predicates) allowing "match" rules to be defined declaratively, to be used in other frameworks. Typical scenarios include testing frameworks, mocking libraries and UI validation rules, to PHP.
</blockquote>
<p>
The <a href="http://fisheye3.cenqua.com/browse/hamcrest/trunk/hamcrest-php">hamcrest-php project</a> compliments other current hamcrest-related projects and his ultimate goal is to make it available to the <a href="http://www.phpunit.de">PHPUnit</a> testing community (as well as with the <a href="http://code.google.com/p/phpmock/">PHPMock</a> effort).
</p>]]></description>
      <pubDate>Tue, 01 Jan 2008 14:16:00 -0600</pubDate>
    </item>
  </channel>
</rss>
