Technical information on this site may be out of date : no updates since 2015

Testing PHP

May 12, 2009 , posted under php testing unit testing testfest phplondon

I had fun this weekend at the PHP London Test Fest, it was a great opportunity to learn something new and meet some great programmers.

The tests our team took on were based around the SPLiterators I hadn’t used this part of PHP before and it was a great way to learn about it, especially as many of the functions we tested aren’t documented yet.

Read More…

simpletest vs phpunit

May 6, 2009 , posted under php drupal testing

There are two main options for unit testing PHP: simpletest and phpunit

They both do a lot of the same stuff, both have the ability to run suites of tests and create mock objects.

Simpletest has a built in webTestCase which allows you to perform some integration as well as unit testing.

An example web test for simpletest is:

Read More…

Cross Platform Testing with Selenium and VirtualBox

April 27, 2009 , posted under php testing agile virtualbox selenium

As well as following standards such as those laid down by www.w3.org I always try and test websites I develop across a range of browsers. Despite improvements in compatibility in recent years, browsers do still vary in implementation and even relatively minor browsers are still used by large numbers of people.

However all this testing can be hard to keep on top of and sometimes I just have to push out what seems like a small code change with only limited testing.

I’m aiming to automate as much testing as possible, this is a little more work up front - but makes re-running tests trivial and so more likely to happen.

Read More…

Continuous Integration Testing for Drupal with CruiseControl (part 1)

April 8, 2009 , posted under php drupal testing svn cruisecontrol unit testing agile phpundercontrol

I recently finished work on a project that really suffered from a lack of build tools.

It was a large project, and while many of us were keen on writing tests we weren’t able to get management sign of to spend some time automating the test process. So even though we did some of the work we didn’t get all the benefits.

It was really frustrating to come back to a piece of work that was well covered by unit tests, only to find those tests broken

Read More…

Using Exceptions in PHP

March 26, 2009 , posted under php drupal

The Drupal project I’ve been working on for the last year involved some fairly heavy file processing, with lot’s of validation.

To simplify the code I made extensive use of Exceptions, I didn’t create that many different Exception classes - but I made sure that any errors which affect the flow of the logic were handled by Exceptions.

Read More…

Drupal file_copy won't work outside of the Drupal install

November 11, 2008 , posted under php drupal

The selected file could not be uploaded, because the destination is not properly configured

This “feature” has bitten me before. It’s one of those annoying Drupal things which would be fine if the error message wasn’t so misleading.

What’s happening is that file_copy() calls file_create_path()

Read More…