Montag, 30. April 2012

Extending the Testclass for Unittests

In one of my last articles on Testclasses for symfony2 I explained some of the classes I use for my tests. Since then I found a great article on metatesting and want to update my UnitTest class to show some practical examples.

Dienstag, 24. April 2012

PHP Garbage Collector and Debian/Ubuntu

I recently stummbled upon a error message in the apache error log that looked like this:

[...] PHP Notice: session_start(): ps_files_cleanup_dir: opendir(/var/lib/php5) failed: Permission denied (13) in [...]

As I wasn't aware what that meant, I researched a bit, finding a php bug issue as well as a ubuntu bug issue. In summary, while php tries to clean up old sessions, debian and ubuntu servers permit the www-data user to do this in the session folder resulting in the error message stated above. The funny thing is that debian/ubuntu have a cronjob which cleans up the sessions, so everything works fine and if you don't look into your apache error log, you don't even notice what's going on.

So, what I did was to set the session.gc_probability in the php.ini to 0 so the garbage collector never tries to do a cleanup. As both the php guys and the debian guys are not willing to discuss this issue and come up with a default way to do this (either lowering permissions on the /var/lib/php5 or using the cronjob as default), I think this is a good way. As said, this should have no impact on your applications.

Montag, 16. April 2012

Deleting not existing remote repositories from Tortoisegit

I struggled with the following problem for some time, so maybe this will help people with the same issue.

We use git for version control and Tortoisegit as gui on top of git. Each developer has many local branches. If something needs to be shared, we push the branch to the remote repository, making it a remote branch.
If somebody deletes a remote branch, it shows up in Tortoisegit for all other developers so everybody ends up with many remote repositories which actually do not exist anymore. Furthermore, trying to delete this entry results in an error message because the branch does not exist on remote (yeah, I know, this is why I want to remove it from my lists, silly!).

To get rid of these, do a fetch on the remote repository and check "prune". Tortoisegit will recieve the information which branches do not exist anymore and delete them from all lists. Your remote branch list is clean and up-to-date again :-)

Happy git-ing!

Donnerstag, 12. April 2012

Testclasses for symfony2

So, when developing with symfony2, I rely on my tests. They are my safety net and without them, I get a little nervous after every change. Does everything work? Did I forget anything? So I developed some classes which I extend. They work on top of PHPUnit and the symfony2 WebTestCase. The classes are used by my different types of Tests: UnitTests, ValidationTests, FunctionalTests (as well as IntegrationTests).