News Feed
Jobs Feed
Sections

Recent Jobs

News Archive
feed this:

CodeUtopia Blog:
Database helper for PHPUnit
August 28, 2008 @ 10:22:12

On the CodeUtopia blog there's a recent post with info on creating a custom event listener in PHPUnit that can help keep you database data completely clean.

When testing code which uses the database, you would usually want to make sure the database stays pristine for each test - All tables should be empty, as any extra data could interfere with the tests. You could probably write an extended Testcase class which automatically does this before each test in setUp and afterwards in tearDown, but it may have some issues. [...] Luckily, PHPUnit has a way to add event listener that react to certain events.

It uses the TestListener interface to make the event handler that (with the help of Doctrine) starts up, makes the tables with data and wipes them out at the end.

Code for the sample listener is in the post and included is the method for checking to see if you even need to use the database or not.

0 comments voice your opinion now!
database phpunit event listener database testlistener



Maarten Manders' Blog:
Static + Unit Tests = Arrrghhh!
August 08, 2008 @ 10:23:08

Take a hint from Maarten Manders when renaming and moving around your unit testing order:

It's absolutely amazing how much you can mess up unit tests just by changing their order! (Trevi_* comes after Tilllate_*) Everyone knows that tests are supposed to be independent. But we all know how it is.

He asks for recommendations on what to do to help the situation. Comments on the post (including ones from Lukas Smith and Sebastian Bergmann) mention using PHPT, a new version of PHPUnit that will do just what he wants and whether or not to use Singletons.

0 comments voice your opinion now!
unittest static phpt phpunit recommend


Raphael Stolt's Blog:
Creating custom PHPUnit assertions
July 29, 2008 @ 10:25:15

Raphael Stolt has written up a post for his blog talking about custom PHPUnit assertions and a simple method to create them.

In this blog post I'd like to set the focus on some of the aspects of the Custom Assertion pattern, by showing how to create custom PHPUnit assertions, which attacks the above mentioned smell [of bad test code] and its retroactive effects with a huge antiperspirant flagon, while also providing the chance to build a customer friendly and domain related test vocabulary.

His first assertion is simple, checking the contents of a bag object to be sure that there are no duplicate items and that its content count is reduced by one if something is removed. Then, he moves on to making the custom assertion for his "IdShouldFollowAgreedConvention" test. He explains how to use the assertion class and how it all fits together in the final, functional test case.

0 comments voice your opinion now!
custom phpunit assertion unittest customassertion pattern


Sebastian Bergmann's Blog:
PHPUnit Workshops in Australia
July 18, 2008 @ 09:34:36

Sebastian Bergmann has posted a reminder for his upcoming PHPUnit workshops happening in Melbourne, Australia (Aug 4th-6th) and in Brisbane (Aug 11th-12th and 14th).

A few seats are still available for both of these workshops. Secure your seat today! I am also available for in-house training, coaching, and consulting around the days of the workshops.

You can save your spot for one of these events by visiting this page and entering you info (you'll want the "Quality Assurance in PHP Projects" option).

0 comments voice your opinion now!
phpunit australia melbourne brisbane workshop quality assurance


Matthew Weier O'Phinney's Blog:
Testing Zend Framework MVC Applications
July 01, 2008 @ 12:05:32

Matthew Weier O'Phinney has posted about a project he undertook to make it simple to test "userland projects" built with the Zend Framework as easy to test as the framework's own Front Controller and Dispatcher.

One of my ongoing projects the past few months has been to create an infrastructure for functional testing of ZF projects using PHPUnit. This past weekend, I made the final commits that make this functionality feature complete.

This new functionality allows you to create stub test case classes, use a Zend_Dom_Query object with CSS selectors/XPath for queries and makes available a special PHPUnit test case that handles the interface between some of the custom functionality (boostrapping, dispatching requests, etc) and PHPUnit.

He includes a sample test case that has assertions for calls to a controller with an action, that a page contains a login form and that a page creates a session and redirects to a profile page.

You can get this functionality from the incubator on the subversion repository for the project.

0 comments voice your opinion now!
testing zendframework application phpunit testcase


Sebastian Bergmann's Blog:
Global Variables and PHPUnit
June 17, 2008 @ 08:49:19

Sebastian Bergmann has a new post today about a feature of the PHPUnit unit testing tool that has the possibility of breaking when objects are introduced - backing up the globals.

It is hard to test code that uses singletons. The same is true for code that uses global variables. Typically, the code you want to test is coupled strongly with a global variable and you cannot control its creation. An additional problem is the fact that one test's change to a global variable might break another test.

You can disable the backup option if you'd like by setting the $backupGlobals option in your test to false. This lets PHPUnit know that you want to leave the globals (and superglobals) alone during the run.

0 comments voice your opinion now!
global variable phpunit unittest backup global superglobal test disable


Ken Guest's Blog:
Book review PHP Objects, Patterns and Practice (second edition)
June 04, 2008 @ 07:58:39

Ken Guest has posted a review of yet another PHP-related book from APress publishing, "PHP Objects, Patterns and Practice (Second Edition)".

While being an easy read, this is a well written, serious book and is aimed squarely at enterprise-level developers and software engineers who make their living through the development and architecture of solutions developed in PHP.

He breaks down the book into the three sections its title mentions - working with objects, design patterns and a healthy dose of PEAR, phpDocumentor, PHPUnit, CVS and phing.

0 comments voice your opinion now!
book review apress object pattern pear phpdocumentor cvs phpunit phing


Michael Kimsal's Blog:
Forget SEO - what about Test Optimization?
June 03, 2008 @ 08:49:37

In a new post today, Michael Kimsal walks through the procoess he followed to try and get the most optimized testing environment he could around a WordPress installation he already has set up.

I've recently been working on a project trying to take an existing customized wordpress site and create automated integration tests around parts of it. I'm using phpUnderControl, phpUnit, Selenium RC, Firefox, Xvfb (virtual frame buffer) and...well, I think that's it.

He mentions the two issues he came across, both with the WordPress software (the "siteurl" setting and the pathing for the templates). He recommends that application code be portable to avoid problems like these. Applications that can be dropped in anywhere and "just work" can help not only make life easier for the installer but also for the tester.

0 comments voice your opinion now!
test optimization unittest phpunit wordpress install problem


Matthew Turland's Blog:
Unit Tests and Code Coverage with PHPT
May 26, 2008 @ 07:54:33

Matthew Turland has posted about some of his experience with PHPT tests with PHPUnit.

Recently, I wrote some for a project and realized that I wasn't aware of how to generate code coverage reports. Many thanks to the very helpful patrons in the #pear channel on EFNet for helping me to get this working.

He show his setup process (on Kubuntu) - grabbing the PEAR package, installing it and how to get a runner script to integrate the PHPT testing into PHPUnit.

0 comments voice your opinion now!
unittest phpunit phpt kubuntu pear package codecoverage


Tillate.com Blog:
Unit test practice at tilllate.com
May 12, 2008 @ 15:46:25

Silvan Muhlemann has posted about the unit testing that tillate.com does for their releases - the whole process from start to finish.

For now over three years we are working with unit tests. I'd like to share some of those experiences. As we have two frameworks in place for our website, I can compare two different strategies for unit tests.

He talks about their choice of SimpleTest, their test monitoring, CruiseControl and their "if it doesn't pass, you can't release it" mentality to keep their site as bug free as possible.

0 comments voice your opinion now!
unittest tillate phpunit cruisecontrol release simpletest



Community Events











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


ajax conference mysql developer package cakephp code PHP5 book release PEAR database releases framework zend application example zendframework job security

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