Image for post: Zend Framework 2 and PHPUnit

Zend Framework 2 and PHPUnit

Modules are the most exciting news on ZF2. All files seem to be organized and the core structure on your application is more clear.

Unit Test on the Skeleton Application

First of all download and install the skeleton application using composer or download the zip file. There are some different way to download Zend2 + Skeleton Application:

I suggest to unzip the skeleton application and the install and update the dependencies with composer. Check out this page on the official website. All the test are on the test directory of every single module. So you can test every single module. Using an IDE like Eclipse or (if you will have a license) Zend Studio will help you a lot to organize files and directory and work on your application.

Centralize your test

I was wondering if It's possible to centralize all unit tests to launch all unit tests of all modules. That's not normally possible on ZF2 like on ZF1.  You have to build your suite test on the root directory on your ZF2 project. Don't worry: it's not so difficult as it sounds! I've found this amazing article on Abdul Malik Ikhsan's Blog. At the end of the configuration, I've had some problem with the second test but the whole setup works perfectly!