Earlier this year I was invited to speak at the Linuxwochen in Vienna first in May. The Linuxwochen is a conference taking place in different time slots at different cities in austria. Besides Vienna these are Graz, Linz, Krems, and Eisenstadt.
This years Vienna conference was hosted by the FH Technikum Wien, not only providing the accommodation and infrastructure for the conference, but also a very stable and reliable wireless network which is not too common on conferences.
What did I talk about?
I was asked by the organizers to talk about PHPUnit. Preparing the talk I thought about bringing some lesser known features, assertions, and annotations to the audience attention. Starting with a selection of command line switches (like –filter, –group, –testdox) I pointed out that some switches only work in combination with previous set annotations and how to use them in a clever way.
This brought me directly to the annotations part. This section of my talk introduced the usage of annotations and highlighted a number of imho most useful annotations provided by PHPUnit. So do the @ticket or @group annotation relate a test directly to a ticket inside of an issue tracker if the value of the annotation is the identifier of the ticket provided by the issue tracker. Using the –group switch, only the tests registered in the requested group are run. This makes it very easy to verify if the bug had returned or not.
In the third section of my presentation I spend some time on some well overseen assertions of PHPUnit. Since I am a big fan of XML/XSLT and the Document Object Model in general, it was a pleasure to find out that PHPUnit has quite a number of assertions verifying the XML string or DOM-object returned by a method or service. Per example expecting two DOMNodes, assertEqualXmlStructure() is able to identify the differences between them and shows them in a diff-like report. By providing true as the third argument, this assertion will also take the attributes into account. This makes it very easy to spot changes or inconsistencies in the response.
Last, but not least I talked about different ways to test for expected exceptions. Therefore I showed some tipps and tricks using the mocking library of PHPunit.
Having no slides we improvised using the provided black board and chalk in order to make things more clear to the audience. It turns out that this is definitely a way of presentation I should do more often ;)
In our presentation we spent most of the time explaining the concept of promises, futures, and defers. This fantastic concept to make asynchronous request ways work together is actually an old one, but was raised again by the commonJS group back in 2009.
This concept makes it very easy to manage asynchronous work paths of your script and, which is the best part, make race conditions disappear. It would be too long to tell you all about the concept right now, but for further reading the commonJS specification is a good place to start.
Will there be a next time?
Certainly. I had so much fun meeting and talking to really nice people and since the Linuxwochen are an annual event I think I will be back next year. Keep up good work fellows!