<?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>Tue, 18 Jun 2013 00:09:16 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Smashing Magazine: Writing Unit Tests For WordPress Plugins]]></title>
      <guid>http://www.phpdeveloper.org/news/17652</guid>
      <link>http://www.phpdeveloper.org/news/17652</link>
      <description><![CDATA[<p>
On the Smashing Magazine site there's a recent post looking at how to <a href="http://coding.smashingmagazine.com/2012/03/07/writing-unit-tests-for-wordpress-plugins/">unit test WordPress plugins</a> via the frontend using <a href="http://docs.jquery.com/QUnit">QUnit</a> (part of the <a href="http://jquery.com">jQuery</a> project).
</p>
<blockquote>
My first goal for the WordPress Editorial Calendar was to make it do anything useful. I was new to JavaScript and PHP and didn't really know what I could pull off. In a few days I had a proof of concept. In a few more I had a working version and was asking friends to install it. The calendar worked...sort of. I spent three times as much time fixing bugs as I did coding. Once the plugin worked, I wrote unit tests to make sure it kept working.
</blockquote>
<p>
He introduces the QUnit testing tool and includes some sample tests showing you how to create both a pass/fail and how to test a PHP value passed out to the page via PHP. There's also a section on getting WordPress and QUnit integrated and only executing when there's a "qunit" parameter on the URL. Actual tests for his calendar plugin are included and you can <a href="http://www.zackgrossbart.com/extras/sandbox/wp-admin/edit.php?page=cal&qunit=true">see the results of the tests here</a>.
</p>]]></description>
      <pubDate>Fri, 09 Mar 2012 10:46:32 -0600</pubDate>
    </item>
  </channel>
</rss>
