<?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 04:25:40 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[QaFoo.com Blog: Howto write a Rule for PHPMD]]></title>
      <guid>http://www.phpdeveloper.org/news/16072</guid>
      <link>http://www.phpdeveloper.org/news/16072</link>
      <description><![CDATA[<p>
On the QaFoo blog today <i>Manuel Pichler</i> has written up a guide to help you <a href="http://qafoo.com/blog/019_howto_write_custom_rules_for_phpmd.html">write a custom rule</a> to use with the PHP Mess Detector (PHPMD) as extended from some of the current rules (it's always easier to start from examples).
</p>
<blockquote>
Let us start with some architecture basics behind PHPMD. All rules in PHPMD must at least implement the <a href="https://github.com/phpmd/phpmd/blob/master/src/main/php/PHP/PMD/Rule.php">PHP_PMD_Rule</a> interface. You can also extend the abstract rule base class <a href="https://github.com/phpmd/phpmd/blob/master/src/main/php/PHP/PMD/AbstractRule.php">PHP_PMD_AbstractRule</a> which already provides an implementation of all required infrastructure methods and application logic, so that the only task which is left to you is the implementation of the concrete validation code of your rule. 
</blockquote>
<p>
He walks you through some sample code and talks about some of the common interfaces that are available to your testing. He takes one of them, IFunctionAware, and looks at it specifically, showing how to use it to detect and add violations for the validation. He includes an example of writing a rule based on an existing software metric (in this case, the number of public methods). There's also  bit at the end showing how to write a rule based on the "abstract syntax tree" to be able to check just about anything in the code you're looking to test.
</p>]]></description>
      <pubDate>Mon, 21 Mar 2011 09:16:57 -0500</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: On PHPUnit and Software Metrics]]></title>
      <guid>http://www.phpdeveloper.org/news/9589</guid>
      <link>http://www.phpdeveloper.org/news/9589</link>
      <description><![CDATA[<p>
In one of his latest entries, <i>Sebastian Bergmann</i> <a href="http://sebastian-bergmann.de/archives/744-On-PHPUnit-and-Software-Metrics.html">answers a question</a> from another blogger about the future of <a href="http://sebastian-bergmann.de/archives/689-PHPUnit-and-Software-Metrics.html">software metrics</a> and <a href="http://sebastian-bergmann.de/archives/690-PHPUnit-as-a-Project-Mess-Detector.html">project mess detection</a> as a part of the <a href="http://www.phpunit.de">PHPUnit</a> project.
</p>
<blockquote>
When I started to work on these projects, there was no other place for me then to develop them as part of PHPUnit. [...] But the more I thought about it, I realized that these features do not belong into PHPUnit but into a suite of tools that PHPUnit is a well-integrated part of.
</blockquote>
<p>
He did, however, include it as a part of the <a href="http://sebastian-bergmann.de/archives/720-PHPUnit-3.2.html">PHPUnit 3.2</a> release at that time. Now, however, there are the tools and platforms to make those tests useful outside of the PHPUnit environment and is allowing him to <a href="http://www.phpunit.de/changeset/2377">move it out</a> from the testing application and on to <a href="http://www.phpunit.de/changeset/2351">closer integration</a> with other software.
</p>]]></description>
      <pubDate>Fri, 08 Feb 2008 09:31:00 -0600</pubDate>
    </item>
    <item>
      <title><![CDATA[Sebastian Bergmann's Blog: Copy & Paste Detection in PHPUnit 3.2]]></title>
      <guid>http://www.phpdeveloper.org/news/8508</guid>
      <link>http://www.phpdeveloper.org/news/8508</link>
      <description><![CDATA[<p>
<i>Sebastian Bergmann</i> <a href="http://sebastian-bergmann.de/archives/693-Copy-Paste-Detection-in-PHPUnit-3.2.html">spotlights another feature</a> of the upcoming <a href="http://www.phpunit.de/">PHPUnit</a> version 3.2 - the inclusion of a <a href="http://sebastian-bergmann.de/archives/690-PHPUnit-as-a-Project-Mess-Detector.html">Project Mess Detector</a>'s ability to help find duplicate code.
</p>
<blockquote>
Duplicate code can be hard to find, especially in a large project. Johann-Peter Hartmann of <a href="http://www.mayflower.de/">MAYFLOWER GmbH</a> recently implemented <a href="http://pmd.sourceforge.net/cpd.html">Copy & Paste Detection</a> for PHPUnit's growing set of features that extends its usage scenarios beyond "just unit testing" to a one-stop solution for quality assurance in PHP-based projects.
</blockquote>
<p>
In <a href="http://sebastian-bergmann.de/archives/693-Copy-Paste-Detection-in-PHPUnit-3.2.html">his example</a>, <i>Sebastian</i> shows what the response will look like when the tests find duplicate code - giving details like the files involved and the code fragment that was duplicated.
</p>
<p>
Check out <a href="http://sebastian-bergmann.de/archives/689-PHPUnit-and-Software-Metrics.html">this list</a> in another post on <i>Sebastian</i>'s blog for more of the metrics that will be included in the upcoming version.
</p>]]></description>
      <pubDate>Wed, 22 Aug 2007 09:31:00 -0500</pubDate>
    </item>
  </channel>
</rss>
