October 16th, 2011
PHP is now quite old in industry and has been used widely in web based applications. PHP has also evolved much more as enterprise web application language. But PHP still lacks a lot many features, which are very commonly and heavily used in Java, .Net or any other enterprise language. One of those lacking features in PHP is 'Multi-tasking' or support for concurrent processing.
To implement multi-tasking in PHP, people have found a couple of ways like by using pcntl_fork(), exec() and curl. You can Google out those solutions easily.
Today, I am going to explain you one more way to implement 'Multi-tasking' using Gearman library and Gearman server. To implement Gearman solution for PHP, you first have to install Gearman server to your machine. You can find more details about Gearman and its installation here: http://gearman.org/
Gearman server comes in 3 flavours C, Java and Perl.
Read more »
July 29th, 2011
Symfony is a one of the best open-source PHP web application frameworks with a huge and comprehensive documentation. Symfony comes with default inbuilt testing framework for functional and unit testing. I recently started working on Symfony functional test cases. I personally found the testing framework very strong and useful.
When I was writing functional test cases for my recent application, I came across with various scenarios where Symfony's documentation lacks or very limited information available on web directly. Here, I am sharing my experiences and solutions for the various scenarios of functional testing.
Testing post request with forms:
Let's take an example if you have any user registration feature and you want to test it (here is a simple code that I used to test):
Assuming that you have registration functionality working with Symfony framework and its URL is http://www.xyz.com/register and it shows a form:
<form action="/register" method="post" >
<th><label for="signup_username">User Name</label></th>
<td><input type="text" name="signup[username]" id="signup_username" /></td>
<td><input type="text" name="signup[email]" id="signup_email" /></td>
<td><input type="password" name="signup[password]" id="signup_password" /></td>
<th><label for="signup_password_confirmation">Confirm Password</label></th>
<td><input type="password" name="signup[password_confirmation]" id="signup_password_confirmation" /></td>
Read more »