Archive for June 15th, 2008

June 15, 2008

Dutch PHP Conference 2008 – Day 1 / Tutorial Day

So I finally decided that I’d attend Sebastians session, so the myth from last blog post is busted :-)
This is the first time I’m seeing Sebastian talk even tho I’ve been to couple of conferences with him so this is a new and hopefully fun experience.

I wrote parts of this blog post during the talk so some of it talks about the session parts as they are in the future, I’m way too lazy to fix it but I do expect everyone that reads my blog is smart enough to just go with the flow on this one ;-)

Another reason why this session is interesting to me is because I’ve been dabbling in phpt all my life, everytime I’ve come across PHPUnit in a software where I have some say in it, I convert it to phpt BUT those are usually PHPUnit v1 which is well … not pretty – I used to use it in some PEAR packages, felt a bit over the top.
Having only touched on v3 a weeeee bit so I’m hoping Sebastian will bring some new light on this and make my mind a bit more open for v3 and v4. Quite funny tho when I was writing the above sentence that Sebastian was talking about that unit tests should be easy to write, I’ve always found the barrier to be higher for PHPUnit than for phpt, maybe it’s just me ? I have always believed that one file per test, it feels like PHPUnit encourages putting many tests in one file which kinda feels … messy, maybe it’s done because people don’t want to be extending some class all the time and fun fun things like that.

Tho as Sebastian points out, phpt is more of a standard and it’s not a unit test framework but in my experience it’s pretty easy to throw in most of the basic functions that people will use in PHPUnit, that’s something we did in pearweb – mock DB, assert funcs and all that but no doubt it doesn’t even start to touch on what PHPUnit does but most of the times you are only playing with the basic features, I’m a bit bias about phpt tho.

While showing how important tests are while refactoring Sebastian showed people how to solve code smells, a term coined by Martin Fowler but he added a little bit that I didn’t know about it, while Martin was writing it he had a new born baby in the household and his wife kept telling him “if it smells, change it” and so he went on to adopt it for coding.

A nice feature I wasn’t aware of in PHPUnit is tagging X many tests as a certain group and then having the ability to execute a group of tests in one file (kinda makes the many tests in one file sound nicer) or across multiple files, or so I believe from what Sebastian said.

Couple of other really nice features were mentioned like: DB_Unit – port of jUnit database stuff to PHPUnit, uses PDO only atm Selenium, cool as always phpUnderControl

DB_Unit and phpUnderControl are two things I have not tried out yet but I will for sure, phpUnderControl just looks awesome and I like the whole idea behind CruiseControl just never gave my self the time to look at it even if Sebastian has been talking about it for …. ever :-)

A bit of a funny tidbit, apparently there was a smallish bug in the html output from PHPUnit and Sebastian told us that this part of PHPUnit is nigh impossible to test – or maybe even PHPUnit it self as whole, didn’t really hear it properly and he’ll shout at me if he ever reads this and wants to correct me :)

The later parts of the post might look a bit … rushed … they are, I’m sitting here in a hotel in London trying to grab it all from memory :-) Mid through Sebastians session I became distracted with fixing bugs and other food related things and thus missed out on parts of the session, which was a pity, good session, really good.

I’m definently going to give PHPUnit another chance after this session but I’m still going to follow the PHPT.info development since it might become something really useful, after all it was born from the pear run test suite (which was born from the original test runner in PHP it self, so that we have the facts right, IIRC hehe)

a note to Derick, arrange a full day workshop of xdebug next time around! I had a real hard time picking if PHPUnit or Xdebug would be the session I wanted to see, then I noticed the xdebug one was a half day one … fail …

All in all, a good day – The evening was a lot of fun, Dutch won the France people, the town LIT up – Fun times

Advertisement
Tags: , ,