Unittest

PHPUnit is a framework to build unit tests and run them
automatically from the commandline. Single tests up to whole test suites (a bunch
of tests, organized through a configuration file) are possible and will improve
the stability and maintainability of every application. It is a fundamentally
part of a continues development, to run existing tests more then once to check if
changes had influence on parts of the system you did not thought of. There is a
lot more you can to with PHPUnit, but that's the core function.

The requirement to run unit tests with the Adventure PHP Framework is the PHPUnit
framework. It is freely available through several sources. The following
section explains two ways to get the phpunit framework.

A convenient way to get the phpunit framework is PEAR. The PEAR CLI provides
an easy way to install and update your packages. Most all-in-one solutions
like XAMPP provide at least the PEAR installer, if not already have pre-installed
some PEAR packages. In the following sections it will be assumed a pear
environment is correctly installed, you can get more information under
PEAR-Installation.

The second possibility to get the phpunit framework is via GIT. You get more
information under the official introduction.
If you have a git client installed, you can use the following commands on the
command line:

If you have the PHPUnit framework installed, there is not much to do to finally
bring the unit tests on the Adventure PHP Framework to work.

First you change directory to tests. There are two files, which
has to be copied and renamed:

Shell

cp phpunit.dist.xml phpunit.xml
cp phpunit.dist phpunit

The file "phpunit" is the script to call on commandline to invoke the phpunit
test application. Before you can use it correctly, you need to open the file and
change the fist constant called PHPUNIT_INCLUDE_PATH, which has the path to the
shared pear library. On Windows based systems you may change the second constant
PHP_BIN_FILENAME to "php.exe".

Now you may call the script phpunit in the directory ../branches/php5/1.15/tests/
from the commandline with the following command:

Shell

php phpunit

The script automatically checks for the default configuration file called
"phpunit.xml" which we have already existing in the current directory.
So if everything works correctly the script should call the described test
suites from the configuration file.

In order to provide a state-of-the-art web experience and to continuously improve our services we are using
cookies. By using this web page you agree to the use of cookies. For more information, please refer to
our Privacy policy.