Saturday, July 26, 2014

Selenium WebDriver + Xvfb + PHP PHPUnit

Selenium WebDriver is one of the best and most mature tools for functional testing of WEB applications, supports wide range of browsers and bindings for all major language platforms.

Here is brief overview of possible selenium setup, which by the way has a lot of possibilities for improvement but can be good for quick and easy start.

Wednesday, October 10, 2012

PHP Copy and Paste detection tool installation

In order to install it you will need to:

1. Upgrade to latest PHPUnit 3.7
2. Install (see instructions inside)
3. Install (see instructions inside)

Then you can run it like:

$ phpcpd /path/to/project/directory

You will see the copy&paste report:

Found 3 exact clones with 53 duplicated lines in 5 files:

  - /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Or.php:136-157

  - /usr/local/src/phpunit/PHPUnit/Framework/Constraint/Or.php:136-157

  - /usr/local/src/phpunit/PHPUnit/Framework/Comparator/Scalar.php:121-132

0.19% duplicated lines out of 27640 total lines of code.

Sunday, June 10, 2012

Easy start with Jenkins for PHP developer

Lets look into the quick and minimal Jenkins setup for middle sized fast growing PHP project.
In order to easy follow this article you should at least:
  • have PEAR installed on server
  • use phpUnit for unit tests
  • build your app with Phing

Wednesday, May 16, 2012

Drupal produces warnings with file_check_directory() on low bootstrap levels

I've found interesting issue with file_check_directory() in Drupal. It generates errors like:

Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /.../public_html/includes/ on line 245

Friday, April 6, 2012

Convert OpenSSH keys to Putty on Linux with puttygen

If you need a Putty ppk key on Linux when you don't have Windows installation, for example when using Windows application that requires ppk-key under Wine. You can use "puttygen" CLI tool in that case.

On Ubuntu:

# apt-get install putty-tools

$ cd ~/.ssh/
$ puttygen id_dsa -o id_dsa.ppk

Make sure you've replaced the "id_dsa" with your private key filename.


Thursday, February 9, 2012

Xdebug PHP scipts profiling examples

Look at this presentation to become familiar with PHP profiling:
And also look into this article for more details:

Edit PHP.ini and add the line:
xdebug.profiler_enable = 1
Restart the Apache and you will find the profiling dumps in /tmp/ .

PHP debug process internals with xdebug

Xdebug debugger allows you to interactively walk through script execution and inspect the call traces and variable values in each appropriate scope.