Unit Tests

Phlickr ships with a set of unit tests to verify its functionality. The unit tests are divided into two separate suites, offline and online. The unit tests are written using PHPUnit2.

On UNIX systems you'll need to be case sensitive, on Windows everything gets forced to lowercase.

Installing PHPUnit2

To install PHPUnit2 and its dependencies it's best to use the PEAR installer:

pear install -a PHPUnit2

Figuring out where the tests are

If you installed Phlickr using the PEAR installer the unit tests were installed into PEAR's tests directory. You can determine what this directory is using the following command:

$ pear config-get test_dir
/usr/local/lib/php/pear/tests

C:\>pear config-get test_dir
C:\PHP\pear\tests

It's unlikely that this directory is in PHP's include path but you can check using the following command:

$ php -r "print get_include_path();"
.:/usr/local/share/pear/:/usr/local/lib/php/pear:/usr/local/share/smarty

C:\>php -r "print get_include_path();"
.;c:\php\includes;C:\PHP\pear

Running the tests

If the tests directory isn't in the include path it's easiest to use PHP to load the test suite:

$ php /usr/local/lib/php/pear/tests/Phlickr/Tests/AllTests.php

PHPUnit 2.2.0 by Sebastian Bergmann.

.........................................
.........................................
.........................................
.........................................
.........................................
..............................

Time: 35.034182

OK (235 tests)

$ php c:\PHP\PEAR\tests\Phlickr\Tests\AllTests.php

PHPUnit 2.2.0 by Sebastian Bergmann.

.........................................
.........................................
.........................................
.........................................
.........................................
..............................

Time: 35.034182

OK (235 tests)

If PEAR's tests directory is in the include path you can call PHPUnit with the class name and it will load and run it:

$ phpunit Phlickr_Tests_AllTests

C:\>phpunit phlickr_tests_offline_alltests

for you, a photo

good photo, lots of intruders

ads

User login