Tag Archives: phpnw

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!

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.