batufa/TESTING.md
2010-07-18 00:07:00 +01:00

1.3 KiB

Unit Testing Kohana

Guidelines for writing unit tests

  • Use @covers - This helps provide proper code coverage
  • Use providers when appropriate - This helps keep your tests simple and makes it easy to add new test cases.
  • When a new feature of bug fix is applied, create a test for it. This may only consist of adding a provider.

How to use the tests

Simply run phpunit from this directory. PHPUnit will grab the config settings stored in phpunit.xml and run the tests for kohana. If everything goes ok phpunit should print a series of dots (each dot represents a test that's passed) followed by something along the lines of OK (520 tests, 1939 assertions).

If the result is instead something like Ok but skipped or incomplete tests then this just means that some tests were unable to run on your system or their implementation is not quite finished.

By default code coverage is not calculated, if you want to collect it then you need to run ./phpunitcc which will run phpunit with the config in code_coverage.xml. Once the tests have finished running open code_coverage/index.html in your browser.

Known failing tests

NONE

  • If any other tests fail for your system, please file a bug