Joomla Testing with multiple PHP Versions

Innovating way to simplicity.

Shyam Sundar Verma , 10 April, 2014

Testing is an inseparable part of software development and better the testing scenarios with variety of platforms, better will be the outcome.

Testing ensure the quality of a Software By-

  1. Check the reliability of the software.
  2. Be ensured that the software does not contain any bug which can become a reason for failure.
  3. Check the software was made according to its specification.
  4. Check that the software meets its requirements.
  5. Check that users are capable of using the software.
  6. Check software works with other software and hardware it needs to work with.

So, these were few points justifying the needs of detailed testing before every release to provide or maintain quality of a software regularly. Testing is important, but it needs to be done in a smart and efficient way otherwise it will become the most cumbersome bottleneck before every release.

In this blog I intend to compare a traditional technique of PHP testing with our developed “PHP test server technique”. I hope it will prove efficient as well as effective for everyone. It will allow to-

  1. Test your applications with Multiple php version in just a second. What’s better than this ☺
  2. Moreover, its open source and free to use.

Conventional way to test with multiple PHP versions.

Testing your Applications with separate Hardware Machines

A developer will be well aware that every testing machine can be allotted only a unique PHP version and a server. So, the most outdated and obvious way is to create many machines or servers and each containing its own PHP versions but that would require a lot of hardware indirectly affecting your cost as well as requiring ton of hard work to recreate the issues in different versions separately.

Testing on separate hardware machine
Testing on separate hardware machine

This is the most outdated method and strictly not recommended to use for testing purposes.

Testing your Application with SIngle Hardware Machine using different virtual machines in it:

Separate virtual machines in single environment
Separate virtual machines in single environment

Next evolvement in the testing scenario was the advent of virtual machines and vagrant which allowed the users to create a whole new environment, complete with the choice of Operating System within a single PC.

This techniques has an advantage that allows the users to create different environment using virtual machine within a single PC but it has few cons such as :

  1. The system should be capable to sustain such heavy processing.
  2. Recreating the issues in different virtual machine requires persistence.
  3. Very time consuming process as the database and source code has to be synchronized separately in all the machines.
  4. All the virtual machines need to be maintained and designed separately.

A new way to test with multiple PHP versions.

What we did exactly, was to create a new flow using the existing technology of Fast CGI.

How does the PHP test server works?

Unlike the above two methods a user doesn’t require to maintain multiple virtual systems and overload the system. Instead the user will just need to setup

  1. A single virtual machine complete with vagrant.
  2. Share the php source code with vagrant.
PHP test server’s workflow
PHP test server’s workflow

The basic fundamental behind the complete working of this model tells that -

  1. We have tried to break the hard binding of a server (Apache) with its PHP versions.
  2. Now whenever the server is triggered the Fast CGI Module comes into play.
  3. Fast CGI Module determines the required PHP version by a user.
  4. Then serves the desired PHP environment for the testing.
  5. Now you can test your single database with different php versions.
  6. You can easily test your php version using test.php file. Refer repo for detail
  7. Just type your required php version server in url and its works

The complete process allows you to maintain a single database of your testing site and implement different PHP versions on it. This will make the switching of PHP versions just a matter of typing a url with desired PHP version.

How to setup the process on your end?

Above was the complete workflow of the process. If you wish to set up this process at your end and simplify the testing process you are heartly welcome to use our Github repo and contribute in it. The Github repository contains the complete usage guidance for your convenience.

Start testing your code with multiple PHP versions

blog comments powered by Disqus