-
Notifications
You must be signed in to change notification settings - Fork 0
OSS PHP Frameworks Unit Testing: zf2
Zend Framework 2 is an open source framework for developing web applications
Download the latest master branch from Github
We did not find official documentation for running the zf2 source code unit tests, although there was documentation on how to create PHPUnit unit tests for zf2-based applications. However, setting up the testing of the zf2 source code was straightforward.
In order to run the zf2 unit tests successfully, make sure you have HHVM, Composer and other basic packages ready to go.
Some initial configuration is required for zf2, particularly around dependencies.
We used composer to install the dependencies. In the root zf2 directory, you will find the composer.json
file that will be used to download the required dependencies to run the unit tests.
hhvm [path-to-composer-phar]/composer.phar install --dev
We used our phpunit
binary to run the unit tests. To run the zf2 unit tests, use the following command from within the tests
directory (e.g., zf2/tests
):
`hhvm [path-to-vendor-parent]/vendor/bin/phpunit`
PHPUnit was installed in the zf2/vendor
directory when we downloaded the composer-based dependencies. It might have been better to use that version of PHPUnit instead of our version since it is possible (although unlikely) that optional packages that the our version may not have contained could be included there. However, in this case, it did not seem to hinder the running of the tests.
We were greeted right away with the fact that HHVM does not implement the internationalization (intl
) extension.
HipHop Fatal error: Class undefined: NumberFormatter in /data/users/joelm/php-open-source-projects/zf2/tests/ZendTest/I18n/Filter/NumberFormatTest.php on line 72
We knew right away that we needed to implement part or all of this extension to get zf2 running correctly.
After getting through the fatals, there were errors and failures in functionality.
This warning occurs when running the zf2 unit tests.
HipHop Strict Warning: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/Los_Angeles' for 'PDT/-7.0/DST' instead in /data/users/joelm/php-open-source-projects/zf2/tests/ZendTest/Feed/Reader/Entry/RssTest.php on line 1874
HHVM does not have a proper php.ini
file to set the timezone settings, which is an overall issue we would like to fix moving forward.
Implement internationalization and move on to determine other fatals and failures.