News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

QaFoo.com Blog:
Howto write a Rule for PHPMD
March 21, 2011 @ 09:16:57

On the QaFoo blog today Manuel Pichler has written up a guide to help you write a custom rule to use with the PHP Mess Detector (PHPMD) as extended from some of the current rules (it's always easier to start from examples).

Let us start with some architecture basics behind PHPMD. All rules in PHPMD must at least implement the PHP_PMD_Rule interface. You can also extend the abstract rule base class PHP_PMD_AbstractRule 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.

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.

0 comments voice your opinion now!
phpmd mess detector rule tutorial


Sebastian Bergmann's Blog:
On PHPUnit and Software Metrics
February 08, 2008 @ 09:31:00

In one of his latest entries, Sebastian Bergmann answers a question from another blogger about the future of software metrics and project mess detection as a part of the PHPUnit project.

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.

He did, however, include it as a part of the PHPUnit 3.2 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 move it out from the testing application and on to closer integration with other software.

0 comments voice your opinion now!
phpunit software metrics project mess detection integration


Sebastian Bergmann's Blog:
Copy & Paste Detection in PHPUnit 3.2
August 22, 2007 @ 09:31:00

Sebastian Bergmann spotlights another feature of the upcoming PHPUnit version 3.2 - the inclusion of a Project Mess Detector's ability to help find duplicate code.

Duplicate code can be hard to find, especially in a large project. Johann-Peter Hartmann of MAYFLOWER GmbH recently implemented Copy & Paste Detection 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.

In his example, Sebastian 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.

Check out this list in another post on Sebastian's blog for more of the metrics that will be included in the upcoming version.

1 comment voice your opinion now!
phpunit unittest metric software copyandpaste detection mess detector phpunit unittest metric software copyandpaste detection mess detector



Community Events





Don't see your event here?
Let us know!


framework install testing developer series introduction language interview list podcast threedevsandamaybe community release opinion laravel unittest wordpress configure code refactor

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework