PrestaShop/PrestaShop — pull request #70 by alexsegura (2012-12-04 21:45:04+00:00)
Title: Unit tests with PHPUnit and Composer

Hello,

Here is a proposal to manage unit tests.

As unit tests are not part of the distribution, they don't suffer from the same constraints (PHP version, environment..).

This is a developer stuff, so this is why I decided to manage them using modern PHP :
* Require PHP 5.3 +, uses namespaces
* [Composer](http://getcomposer.org/), to manage installation of libraries, including PHPUnit
* [Faker](https://github.com/fzaninotto/Faker), [Mockery](https://github.com/padraic/mockery) as utilities, and why not [Alice](https://github.com/nelmio/alice) ?

$ cd tests
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install
$ vendor/bin/phpunit

Right now I have written few test cases for utility methods, but this pull request aims to simplify writing & running unit tests for other contributors.

This is a long road, but having unit tests is becoming mandatory now that there are new contributors and supposedly more code changed.

I also have some utilities to stub the context & the configuration that I created in another repo.

I have never done that, but it should be possible to configure [Travis](https://travis-ci.org/) to automatically run the tests.

Hoping you will like it !