Tag: debugging

How to find the reason for a risky test in PHPUnit ?

How to find the reason for a risky test in PHPUnit ?

Recently I started phpUnit testing, and I found some of the test are flagging as risky. Most of the time I able figure bout reason but some time it very time consuming and also there isn’t any messages from PHPUnit.

Get php class file path from class name – ReflectionClass

Get php class file path from class name – ReflectionClass

During development of common library for WordPress plugins and themes ( WordPress development helper library ), I just want to find from which plugin it is called ( I just want to debug the code, but I used in many plugins and i am not 

PHP profiling using webgrind and Xdebug

PHP profiling using webgrind and Xdebug

Install xdebug

sudo apt-get install php5-xdebug

Then update config

Add following line in /etc/php5/fpm/conf.d/20-xdebug.ini

xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp

After that please restart php5-fpm

sudo service php5-fpm restart

Load page you want to optimize

It will take time (If its taking too much time then need to optimize 😛 )

Install webgrind

Simply decompress the package into a folder in your server and load its path it in the browser. It is written in php5 and it does not have dependencies to configure.

wget https://webgrind.googlecode.com/files/webgrind-release-1.0.zip && unzip webgrind-release-1.0.zip

Open webgrind in your browser and observing the result

You can get more details from github