Tag Archives: conference

Test your code like a pro – PHPUnit in practice – preparation guide

As promised, here’s a quick guide that will allow you to prepare for my “Test your code like a pro – PHPUnit in practice” tutorial at PHPNW12 conference in Manchester on 5th October. If you still haven’t decided whether to go or not have a look at the official abstract and my previous blog posts. There is still time to get the tickets!

There are really 2 things that you will need, to get smoothly through the tutorial: git client and working installation of PHPUnit. So please make sure you have installed them and you can use them. Being able to open PDF files is also recommended as I will be giving out a tutorial’s manual/instructions in a PDF format.

Well this above obviously requires a computer. I guess you will decide to bring a laptop with you, although if you prefer to take your desktop computer with you, it will do too. While most of the stuff will be in the PDF file, going through the tutorial without a laptop will be difficult to follow and you will not learn as much. I will not have any spare laptops to borrow, sorry.

I strongly discourage brining in a Windows machine with you, unless you feel comfortable with solving any problems related with php, pear and PHPUnit in a very short period of time or you come really well prepared. We will not have a lot of time to spend configuring each other machines and we also don’t want the others to wait and do nothing while you set everything up. We only have 3 hours, and believe me it will go fast.



Using apt to install git should set you up pretty quickly. Just type in the below:

$ sudo apt-get install git-core
$ git --version


You will need at least PHP 5.3.3 installed, but I strongly recommend installing PHP 5.4. Again with apt it should be pretty instant to get you set up:

$ sudo apt-get install php5-cli
$ sudo apt-get install php-pear
$ sudo apt-get install php5-xdebug
$ php -v


Before you can install PHPUnit you need to make sure PEAR is at the latest version. So upgrade it first

$ sudo pear upgrade PEAR


Then finally you will be able to install PHPUnit:

$ sudo pear config-set auto_discover 1
$ sudo pear install pear.phpunit.de/PHPUnit
$ phpunit --version



You can install git client on a Windows machine by using the installer package that you can download from msysgit project downloads page.

Just accept all the default options. All you really need is to be able to clone a repo and change branches.


  1. First download PHP 5.4 binaries from http://windows.php.net/ and unzip it into c:\php.
  2. Then download xdebug library from xdebug downloads page and copy it over to c:\php\ext directory.
  3. Rename the library to php_xdebug.dll.
  4. Copy c:\php\php.ini-development to c:\php\php.ini
  5. Make sure date.timezone is set to “Europe/London”
  6. Activate xdebug by adding the snippet bellow at the end of c:\php\php.ini
  7. [xdebug]
  8. Add c:\php to system path via Computer’s Advanced Properties -> Environment Variables
  9. Restart windows
  10. In the command prompt run:
  11. c:\> php -v
    PHP 5.4.7 (cli) (built: Sep 12 2012 23:48:31)
    Copyright (c) 1997-2012 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
        with Xdebug v2.2.1, Copyright (c) 2002-2012, by Derick Rethans


Next we have to install PEAR.

  1. Download go-pear.phar from http://pear.php.net and copy it over to c:\php\
  2. Run the following command and from the presented options change option 1 – Installation base to c:\php and option 11 – Name of configuration file to c:\php\pear.ini
  3. c:\> php c:\php\go-pear.phar
  4. Then hit enter to finish installation
  5. Let installer change your include path at the end by answering y to the question “Would you like to alter php.ini?”
  6. Double-click the PEAR_ENV.reg file in c:\php
  7. Reboot again to make sure PEAR_ENV registry entries have taken effect


Finally it’s time to install PHPUnit. At this point just running the below should set you up.

c:\> pear config-set auto_discover 1
c:\> pear install pear.phpunit.de/PHPUnit

c:\> phpunit --version
PHPUnit 3.7.0 by Sebastian Bergmann.

If at any point you have a problem with installing it all on Windows please drop me an email. You can also have a look at Stu Herbert’s blog post about Getting PEAR working on Windows 7

I hope this short guide will let you come to my tutorial well prepared. I will see you in Manchester soon!

The Grumpy Programmer’s Book at PHPNW12

I’ve got some good news for the people that already have decided to attend my tutorial “Test your code like a Pro – PHPUnit in practise” at PHPNW12 conference in ManchesterChris Hartjes has kindly offered to give away 3 digital copies of his famous “Guide To Building Testable Applications in PHP” book to attendees of my tutorial! I strongly believe this will nicely compliment the tutorial itself and give the people such a boost in their further adventures with testing. You can learn more about the book itself at http://www.grumpy-testing.com/.

Your still have a chance to get a ticket to my tutorial on 5th October and only one more reason to buy it! For these who already know PHPUnit and already have started they journey through unit testing PHP code I strongly recommend buying the book and reading it. There is plenty of hints and tips that will help you understand how to write unit testable code and increase its quality!

Big thanks to Chris again and I hope to see you all in Manchester soon!

Test your code like a pro – PHPUnit in practice at PHPNW12

PHP NW12 conference is nearly upon us, so I guess it’s about time to tell you more about the workshop that I will be having there on the 5th October morning. I wanted to do that for a very long time, especially that I am a big fan of quality assurance in software engineering. You can read the official abstract at the conference homepage, but here I am gonna tell you a little bit more about what we gonna do during the 3 hour tutorial.

My main focus will be to teach you and lead you through main concepts of unit testing PHP code. It’s a beginners course, so we will go though all the basics of organising your test suite, understanding the benefits of unit tests and making you feel comfortable and confident with the code you write. We’ll do it all big band TDD style – so we will write the tests first and implement the functionality afterwards. It’s very important to get this right and to set up the mindset from the very beginning.

PHPUnit is de-facto a standard in PHP world, so it is also important that you are aware of the main features of the tool. We’ll go through the set up, configuration and options that are the most useful at the beginning – so you can get the most out of the tool. The concepts that I am gonna go through will include:

  • working with typical test suites
  • basic assertions – strings, integers, booleans, object
  • PHPUnit from the command line
  • using phpunit.xml configuration file
  • testing exceptions
  • testing PHP errors, warnings and notices
  • asserting output
  • data driving your tests by using data providers
  • generating code coverage report

If you have never had a chance to unit test your code, but you’d like to try now, it’s the best time to get started. I will do my best to make you feel confident and to help you start your own Journey Towards Continuous Integration, but what you have to do is to go to your boss and convince him to buy you a ticket to my tutorial ( and the conference). There is still plenty of time and there are still some tickets left.

No matter whether you have already bought a ticker or you’re thinking about right now, if there is anything specific you you want me to go through during the tutorial please let me know. I’ll do my best to fit that in. We can also change the course of the tutorial if the group will prefer to touch on some slightly different subjects of unit testing – I am open for suggestions. And I will be accessible after the tutorial too, for any questions, help or even quick hacks. You will even get more chances to speak to me over the next 2 days, during the main conference days – on the 6th and 7th October.

It’s a lot of things to go through so it is very important that you come prepared and focused on the day. We only have 3 hours and I’d like to avoid situation where the hardware/operational issues will stand in our way. While I will try to help everybody out if there are any issues I will encourage you to install PHPUnit on your laptops before, so it is working without a problem. I want to focus on writing the tests and using PHPUnit, not on trying to make PHP itself working on your machines.  I strongly recommend using a non-Windows system. Windows has been proved to be very unreliable if it comes to setting up PHP and PEAR. It does work, but it requires some strong skills and patience. So you’d rather install ubuntu or debian, as this is an environment that everything just works out of the box.

During the course of the next 2 days I will post more detailed instructions about how you can prepare your laptops to make sure you can run PHPUnit on them without any issues, so watch this space closely.

I hope to see you at my tutorial in about 3 weeks!

Symfony2 Live! London – aftermatch

Symfony Live LondonI am sitting on the train back to Sheffield coming back from an awesome Symfony Live London event. It was my first time at Symfony Live conference, and at the same time it was first edition of the conference held in London. Conference was organised perfectly, but was else could you expect from  people like Lorna Jane and Wes Thompson! Great event guys and very well done!

For a person like me, who only started working with Symfony2 a few months ago, it was a mind blowing mine of information about Symfony2, tools that support symfony2 applications like composer and behat and general practises around using the framework itself. I was pretty impressed by the fact how Drupal8 and Symfony2 work together, and get the famous CRM event better. It definitely proves that PHP as the language, environment and surrounding community matures. The talks in fact were only the background of the opportunities that I had today – meeting in person and being able to talk to people like Fabien Potencier (creator of Symfony2), Jordi Boggiano (the man behind composer), Konstantin Kudryashov (the Behat man) and Marcello Duarte (the PHPSpec man). The conference venue was all buzzing – people talking and exchanging experiences.

I have seen 6 talks in total:

Every talk was unique and touched on different subject, but I have to admit Konstantin and Marcello just blown my mind off with they approach to testing with BDD. I still can’t get all the things together and they gave me plenty of things to think about. The next thing I will do will be to replicate what they have done with Behat and PHPSpec2 during their presentation.  I do not agree with what they have said about unit testing, and I still believe that unit testing has it’s own place in the development processes, just needs to be used right and for the right purpose. For me the BBD way they have shown us it’s a different approach to testing only complementing xUnit. Anyway have a look at their slides and at Behat and PHPSpec2 if you haven’t yet. PHPSpec2 is still pre,pre,pre,pre,pre,pre,pre,[pre,] alpha, but looks really promising and I can see myself including it in my toolset.

Finally, I’d like to thank everybody who attended my talk Effective Code Reviews and asked all the questions afterwards. It’s been a pleasure to be able to meet you all and exchange all the experiences around code review process. Thanks to everybody who left the feedback on joind.in, and if you have seen my talk and not yet gave me the feedback please do so. It’s very important for me to know what did you like and what not, so I can improve it in the future.

Enough writing, I am too excited about Behat and PHPSpec2 so I am gonna download it and play with it for another hour, and I hope to meet you all again in a year time at the the next Symfony Live! London Conference!

Speaking at Symfony Live London

Symfony Live London It’s quite late now, but there are still some tickets and time to get on board and come to London to participate at Symfony Live London conference this Friday (14th Sept 2012). The lineup is pretty impressive, including well known speakers like Fabien PotencierJordi BoggianoRowan MerewoodRichard Miller and Konstantin Kudryashov. The more honoured I feel to be able to speak amongst them. I will be talking about code reviews and will share my experiences “straight from the field”. I count on you to challenge me and discuss all the things about development processes, specifically around code quality.

See you in London!

Speaking at Forum PHP Paris 2012

I am getting very excited about next week. I will be speaking in Paris at Forum PHP Paris 2012 conference about software metrics. So if you are interested in software metrics or you want to learn how to read them and use them to produce better software grab a ticket and come to Paris next week. I am looking forward to meet some old friends and also to make some new friendships. Hopefully my inability to speak French will not stop me 😉

PHP Benelux 2012 – 4 days of awesomeness

PHP BeneluxI was extremely pleased that I was invited to talk at the annual PHP Benelux conference in Antwerp. It was my first time in Antwerp, but I have heard about this conference so much before. And I must tell, all of it was true.

The arrival

But starting from the beginning, which was the landing of PHPNWAir plane (as named by Michelangelo van Dam) with a representation of 7 people from British PHP NorthWest Community (including 3 speakers – Rowan Merewood, Jeremy Coates and me) in Brussels Charleoi. And yes, I do admit it was a poor choice of mine to decide to fly Ryanair from Manchester to this airport. Connection is bad, it’s about an hour drive from Antwerp, and if not the help from PHP Benelux crew (namely @DragonBe and @Martin1982) we would be in trouble. So I am sorry once again guys, I won’t do it again! 😀


From then on I will only guess what heppened next, as I have problems recalling what happened on what day. Speakers dinner was an amazing opportunity to meet the conference crew and speak to the other speakers. A rare occasion indeed. Some of them I already knew from previous conferences like PHPNW, PHPUK and 4developers, but some of them I had the pleasure of meeting for the first time, face to face. There is nothing better, then speaking to other experienced developers at a conference, truly amazing and unique experience. How often you have an opportunity to meet people like @derickr, @weierophinney, @rdohms, @davidcoallier, @dzuelke, @joshholmes, @h, @DragonBe, @skoop and @ianbarber in one place at the same time? And that’s only a short list, cause I could go and go and go naming them one after another!

The conference was executed perfectly! I couldn’t be looked after better even by my own mother! @ThijsFeryn@DragonBe@Martin1982 and the rest of the crew – it’s a massive thank you from me! Sponsors did great too – @ibuildings and @engineyard responsible for the afterconference socials helped a lot with maintaining the spirit and helping everybody enjoy the conference to its very limits! We had so much fun bowling on Friday night (and yes I won!) and watching @juokaz and @dzuelke competing – whether it was about which phone is better or who’s better at Kinect Tennis! Can’t deny the fact that beer tasting session and Belgian fries and spécialités also helped during that day.

The winter BBQ, well… it was bloody cold, but again the beers, liquors, hot food and @Orchestra_io scarf helped to survive the evening. We even managed to go for a pizza to Antwerp late night when we got hungry! Some people even managed to come back in a car’s boot!


But conference it’s not about fun, but first of all about learning. And hell yeah, there was a lot to learn! I have seen a number of talks (and shamefully missed a few ones for reasons I am not gonna mention here ;)).

I’ll start with @dzuelke‘s  “Large-Scale Data Processing with Hadoop and PHP”. David is always an inspiration for me – an excellent speaker with really good talk. This one definitely gave me a few ideas how I could use Hadoop in my daily job. Hopefully I will find some time to come up with some prototypes.

Helgi Þorbjörnsson also gave a solid talk on “PHAR, the PHP .exe format”. While I already knew a few things about phar, he definitely managed to mention some interesting things about phar I didn’t know before. I really liked the way he engaged the audience. Really good idea!

Rowan Merewood and his “Estimation or, “How to Dig you own Grave”” was another great performance. Nothing new for me there (well, we worked together for a number of years), but I always admire Rowan for his slides and the way he talks. A true masterpiece.

Matthew Weier O’Phinney’s “VIM + *nix Toolchain == PHP IDE” definitely inspired me again to come back and learn a few new things about vim. Inspirational speaker with a lot of charisma!

“PHP traits, treat or threat?” by Nick Belhomme was the talk I really wanted to see since I really didn’t have any time to look at PHP 5.4. While the talk was a bit chaotic at times for me, I still learned a lot about traits, and as of now, I know one thing – I don’t think I like them and I don’t think I will use them – it’s more of a threat for me. They seem to be too messy.

You could tell Marcel was nervous during his “The lust for knowledge and experience” talk. But still it was a good talk with very good professional slides. It was a chance for me to rethink a few things about the relations between “the master”, “apprentice” and “a junior”.

Finally, the best talk of the conference from David Coallier “Taking it to the next level”. I absolutely loved the way he did his talk and how he engaged the audience. He only made me realise how rarly we tell other how much we appriciate their work and how we all take the work of others for granted. Thanks you very much for that David!

My software metrics talk

At last I’d like to thank everybody for attending my “Magic Behind the Numbers – Software Metrics In Practice” talk. I am really glad, that more and more people are looking at improving the quality of their code and want to learn more about it. I was impressed with the fact how many people in Benelux are using tools like PHP Depend and PHP Mess Detector! Keep it up guys! Thank you very much for all the feedback. I’ll definitely use it in the future to improve my presentation and make it more interesting. You can find the slides from my talk on slideshare.


I will definitely do my best to come back to Antwerp next year, but until then I hope to see you next month in London at PHPUK 2012!

Software metrics at PHPNW 2011 Conference

PHPNW11I am really excited to be able to speak again in Manchester this October. This time I will be speaking about the ways and tools you can use to assess your code quality and its design. While software metrics help a lot and tell a lot about code, you have to remember they only should be treated as a guidance, not the goal in itself.  So be careful and don’t start coding only to make the metrics look pretty. Here is an excellent video from Alberto Savoia for these who’s gone a bit too far with software metrics.

See you in Manchester!

February aftermatch

Finally, during the first days of my holiday, I have found a few days to finish this post.

Well, Feb this year has been extremely busy. First hot house at work, a brand new idea for me that worked brilliantly, then PHP Unconference Europe in Manchester, and finally PHPUK 2011 in London. And although that was already March, it’s worth adding PHPNW monthly user group meeting in Manchester as well, where I had a talk about PHPUnit, the next one in “Back to basics” series.

But lets start from the beggining.

The hot house

Brand new idea for me. We got off site for 3 days from the office to prototype and implement a first version of our end to end continuous integration process. And by end-to-end I mean end-to-end – form project initialisation to the final release integration and automated deployment. It’s been 3 very exhausting days, not the usual 9-5 working day you usually have at work, but it was well worth having it. The idea of it is, you get the gather the whole team – developers, project managers, BAs, QA engineers and everybody else that are crucial for the project, in one room, away from any sort of distraction and plan (and most importantly execute) the whole thing. The 3 days have a specific structure, with the 1st day being sort of introduction and planning, 2nd day being entirely focused on execution and 3rd day, the shorter one, being a wrap-up and summary of the whole event with the main goal of raising post event actions that are meant to be executed in the office afterwards.

During this 3 days we achieved something that we couldn’t in the past several months – we have put a concept in place and implemented it proving the the whole thing can work. Now we know that we can automate the process of developing, building and testing single project workstreams and when they are ready put them altogether during a merge into a release, build, deploy and test the whole release. That includes both PHP and Java artifacts, DB changes, internal CMS artifacts and regression selenium packs and functional tests developed and executed during the project. Oh! How I love automation.

PHP Unconference Europe (19-20 Feb 2011)

Official site: http://www.phpuceu.org/phpuceu-2011/
Unconference wiki: http://eu.php-unconference.de/

I was looking forward to it very much. I have never been to an unconference before, and I didn’t quite get the whole idea of an unconference. Well, I knew roughly the idea behind it, just never seen it in action.

So, in general I am a bit disappointed. As a completely community driven event it was an enormous success. A load of people turned up, we had a few interesting proposals upfront, then a few more was added during the event. From the organisation point of view it was brilliant. Everything went smoothly, beer was good, food was good, people were great. The bit that needs improving are the talks itself. And I don’t blame anybody for it. In fact if I could blame somebody I would start from myself. The talks that were proposed upfront and were chosen by the community went quite well. The disussion panels – not so much. They weren’t bad, don’t get me wrong. They just simply could be better. But I already know, that next time I will come better prepared. Always learn on mistakes – that’s my motto.

PHPUK 2011 (25 Feb)

Official site: http://www.phpconference.co.uk/conference/php-uk-conference-2011

Just 5 days after, I attended another big UK event, this time in London. Schedule this year was pretty impressive. I was mainly interested in the two afternoon talks in Auditorium – Sebastian Bergmann’s “Agility and Quality” and Thorsten Rinne’s “Continuous Improvement in PHP Projects”. But before I get to them, let’s rewind and start from the beginning.

The conference had started with Marco Tabini’s “Experience” key note. Marco refereshed the idea od user experience with a few funny anecdotes and targeted it specifically at developers. Nothing really new, but we all need to be reminded from time to time, that we should always be focused and don’t forget about end users and their needs.

After that I had to choose between 3 talks:

  • Martin Beeby’s “HTML5 and CSS3 Today”
  • Ivo Jansch’s “PHP in a Mobile Ecosystem”
  • Ian Barber’s “ZeroMQ Is The Answer”

I didn’t hesitate a second and went straight away to Sidetrack 2 to see what ZeroMQ is all about. And I don’t regret my decision. I think it was the best talk of PHPUK 2011. Ian kept me focused all the time and definitely convinced me to try out ZeroMQ. Great talk, with plenty of usage examples and a demo. Well done!

After a short break it was time for the talk I was waiting for. But again the choice for me wasn’t difficult either. We had:

  • “Xdebug” by Derick Rethans in Sidetrack 1
  • “Agility and Quality” by Sebastian Bergmann in Auditorium
  • “Running on Amazon EC2” by Jonathan Weiss in Sidetrack 2

I had seen Derick’s talk before and I am not really interested in Amazon EC2, not just yet at least. So I went straight away to see Sebastian’s talk. Sebastian is a well known international speaker, practically an expert in QA for PHP topics. And maybe that’s why I was really disappointed. Sebastian seemed to be nervous at the beggining, although it went better as he went along. Still I was expecting something new. Instead of that, the talk brought up some of the well known “agility practices”, how they fit in during project lifecycle and how some of the tools can help to achieve that. Nice WOW theme made it look interesting, but not interesting enough to keep me focused.

I have stayed at the Auditorium to listen to “Continuous Improvement in PHP Projects” by Thorsten Rinne. The other 2 talks that I have missed were:

  • “Large-scale Data Processing with MapReduce and PHP” by David Zülke in Sidetrack 1
  • “The InnoDB Storage Engine for MySQL” by Morgan Tocker in Sidetrack 2

And I must say, that was the worst talk I have heard during the conference. It seemed Thorsten either didn’t prepare very well to do this talk or he had real problems expressing himself. Not that I couldn’t understand him, but he was repeating some phrases all over again. Adding to that, some of the things were pretty much the same things Sebastian has talked about just before. The significant amount of time was spent introducing and explaining how to install some CI tools. And then, during Q&A session, he said some things that I strongly disagree with, like advising to implement CI process (and doing unit tests) without telling that to management. In my opinion that is the worst thing that you can do. I really regret I didn’t go to Sidetrack 2 and didn’t see David Zülke’s talk. I am sure it was much much better.

Next talk I have chosen was “Optimising a Zend Framework Application” by Rob Allen. It was a difficult choice, as I also wanted to see Stuart Herbert with his “Beyond Frameworks” talk in Sidetrack 1. I wasn’t that interested in Lorenzo Alberton’s “NoSQL Databases: What, When and Why”. All I can say, Rob delivered a good talk again. Learnt a few things about Zend Framework, which will definitely help me in my day to day job. I only heard that the other 2 talks were equally good and interesting!

At last I have attended “Advanced OO Patterns” by Tobias Schlitt in Auditorium. The other 2 talks were:

  • “Varnish in Action” by Thijs Feryn in Sidetrack 1
  • “99 Problems, But The Search Ain’t One” in Sidetrack 2

It was a good talk with a bit of humour. Tobias went through some of the design patterns explaining their pros and cons. Nothing really revolutionary, but it is always good to refresh this stuff from time to time. Shame that, at the same time Stuart Herbert and Jeremy Coates where discussing phpfundamentals matters at the lobby. I have left the talk to join them to learn more about that.

In general I must say it was a successful event, very well organised. Good food, free beers at the end and the after conference socials at “Slug And Lettuce” only made it better. I will definitely try to attend the next edition in 2012!

PHPNW montly user group meeting

I try to attend this local community event whenever I can, so I couldn’t miss it this time either. Especially that I was going to to do an introductory talk about PHPUnit. When I have arrived there was only a few people, so we have decided to wait a few more minutes to wait for the late comers. And it appeared to be a good decision as in the next 20 mins or so the room was nearly packed full! I went through some basic features of unit testing based on some live examples. A small accident near the end made me finish the talk without the slides (my MBP battery went out of power), so I had to improvise a bit, but I think, overall, it all went pretty well as we had quite a few questions afterwards and a really nice discussion at the end. You can find the slides from the talk on slideshare.