Although most modern literature agrees that testing is essential for successful software projects, testing has to be done right. Several bad habits can be identified that not only negatively affect testing performance, but also reduce your development speed. One of the first mistakes people make when they first discover testing is trying to reach 100% code coverage. I was no exception. Read the rest of this entry »

Written by: | 5 Comments | Category: Best Practices

Unit testing can be a blessing and curse at the same time. Once you start doing it on a regular basis, it can become an addiction. You test everything, you feel the satisfaction of 110% test coverage giving you confidence in your code. But after a while, testing suddenly seems to slow you down. Everytime you make a change in your code you have to adapt several unrelated tests. Adding a <ul>-tag to your template becomes a matter of minutes, rather than seconds. And, worst of all, your test suite is slow.

What happened? Read the rest of this entry »

Written by: | 13 Comments | Category: Best Practices

Thank You

Yesterday I returned back to Vienna from Symfony Day Cologne 2009. The conference was amazingly well organized and many people deserve credits for making it such a great experience.

Symfony Day Cologne 2009

© Nicolas Perriault

Thank you Andreas and Dennis for putting uncounted hours into planning the event, guiding us around the city, spending the night before fixing the wireless connection and for taking care of all the other small things that usually go by unnoticed. Thank you Isabelle for your Cologne crash course and for organizing our flights and the perfect accommodation. Thank you Nicolas for your many thoughtful advices, I really appreciate them. Thank you Xavier, Stefan, Jon and Sebastian for your refreshing company; I really enjoyed the lengthy walks around the city, even though my foot complained somewhat. Thank you all the attendees who gave me feedback about my work and my presentation. Thank you Interlution for letting us take part in your 10 year anniversary party. And thank you all the other people involved in making this event a success.

Events like this one are really important for the community. They put faces behind names, make friends, open up new opportunities and spread ideas. They are what open source truly is about.

As another result of the conference, this blog features a new page Talks where I included the slides of my presentation Best Practice Testing with Lime 2. And to those who annoyed me about Twitter – apparently some new account @webmozart has been created over there. Don’t know who it is, but don’t expect him to tweet too much.

Written by: | No Comments | Category: Community

Today, I will take the plane to Cologne to attend the first german Symfony Day. The one-day conference is going to take place on friday on the 28th floor of the Köln Triangle, the second highest building in Cologne. Located directly at the bank of the Rhine, the tower offers a magnificient view over the city. Interlutions, the company organizing the event seems to have done a very good job.

View from the Köln Triangle

Image Courtesy of

The conference will offer a full-day workshop held by Stefan Koopmanschap for those who are just getting started with symfony. Advanced symfony users can attend five promising speeches by Nicolas Perriault, Xavier Lacot, Rob Bors and Jonathan Wage, who is accountable for two presentations. I had the pleasure to be invited as the fifth speaker, and I am going to talk about unit testing.

Automated software testing, when applied in a real context, is not always as easy as it may sometimes be portrayed. You need experience to design your software in a testable fashion, discipline to keep writing tests when pressure keeps increasing, tools to support your testing needs in the best way possible and knowledge to employ these tools efficiently. If any of these aspects is lacking, your team may very quickly end up not writing any tests at all. Even if you fight your way through the battle and manage to keep test coverage high, chances are that your tests become very slow. A bad test performance, in turn, prevents people from running them frequently enough – and turns all your testing efforts into a waste of time.

In my presentation I want to give you a deeper insight on what testing is all about. Not only do I want to present you best practices that worked for me, I also want you to understand the testing process so that you can go on developing best practices for yourself. I will try to focus on pratical examples; nevertheless I expect you to have a fair knowledge of writing and reading unit and functional tests with lime. For all those who won’t be able to join, the slides will be uploaded on this blog as soon as I probably can.

The presentation will also give you the opportunity to get a first glance of what Lime 2 is going to offer you. I have been busy developing the successor of lime over the last months and am happy to see that it is steadily approaching alpha release. The detailed release plan is soon to be published on the symfony blog.

I am already excitedly looking forward to meeting you all!

Written by: | 6 Comments | Category: Community

The “default” context does not exist.

Is there any symfony developer out there who never stumbled upon this dreadful error message? I doubt it. Recently, a lot of posts have been made on the user mailing list asking for explanations and fixes. A quick search on Google for the exact phrase even returns 480 results!

The reason for this error is quite simple though: It’s because you used sfContext::getInstance(). And you should never do that. Read the rest of this entry »

Written by: | 23 Comments | Category: Best Practices

Unit testing is a very important task of professional, scalable software development. Many tools exist to support unit testing in one or another way. All tools come with advantages and drawbacks. One of the best known test frameworks in the PHP world is PHPUnit. With the release of symfony, Fabien Potencier released another new testing framework for PHP: lime. The biggest advantage of lime over PHPUnit surely is the conciseness of the written test code. There are several disadvantages as well, which include bad test encapsulation due to the lack of support for fixture setup and teardown, and missing support for mock object generation.

Today I will briefly speak about the advantages of both frameworks, and how they can be combined to result in a slicker, powerful testing framework. I will show you how easy testing really can be! And you will be able to try it out, because all the required code has already been released in sfLimeExtraPlugin.

Read the rest of this entry »

Written by: | 18 Comments | Category: Development

Hi! A warm welcome to Web Mozarts also from my side. It took some time to write my first post, but here it is!

Your app is slow? If the symfony web debug toolbar doesn’t give you the details you want, you can take a real deep look into your application using the profiling options of Xdebug.

In this tutorial we will set up Xdebug to profile your application and then we’ll analyse the output with KCachegrind.

By the way: Xdebug has a lot of other useful features. One that comes automatically is the nicely formated php debugging output in case of errors including the full call stack. KCachegrind on the other hand has very interesting graphical output features like the call graph. In the case of symfony the call graph can be like an interesting expedition into the functionality of the framework.

Read the rest of this entry »

Written by: | 5 Comments | Category: Tips & Tricks

Keeping all parts of a website consistent is one of the most time consuming tasks of a web designer. Spending this time is worth doing, because the more consistent the look and feel of your website is, the more professional it appears to its users.

I will show you today how symfony could help you keeping all of your forms consistent with very little work left for you to do. Read the rest of this entry »

Written by: | 13 Comments | Category: Thinking Ahead

Today I want to follow up on my last post about improving the forms in symfony. David Hermann wrote a quite interesting reply on his blog. I want to take some of his ideas and enhance them even further. The goal is to be able to reuse as much code as possible when creating applications with lots of different forms.

This post will be different though. While I only made assumptions in my last post without any code verifying that my ideas are implementable, I do have a prototype implementation now. Read the rest of this entry »

Written by: | 8 Comments | Category: Thinking Ahead

After my last post about simplifying symfony and especially the forms framework, I started diving into the forms framework to find out how we could improve it. I tried to find ways to improve the usability of this framework without reducing its mighty possibilities. Quite the contrary, I think that the forms can be made even mightier than they are now. Read the rest of this entry »

Written by: | 18 Comments | Category: Thinking Ahead

Additional Resources