Merge branch '3.0.x' of github.com:kohana/kohana into 3.0.x
[kohana.git] / TESTING.md
blobffb17e6e3765e15d6f5574169950c66d2c8db9a1
1 Unit Testing Kohana
2 ===
4 Guidelines for writing unit tests
5 ---
7  * Use @covers - This helps provide proper code coverage
8  * Use providers when appropriate - This helps keep your tests simple and makes it easy to add new test cases.
9  * When a new feature of bug fix is applied, create a test for it. This may only consist of adding a provider.
11 How to use the tests
12 ---
14 Simply run `phpunit` from this directory.  PHPUnit will grab the config settings stored in phpunit.xml and run
15 the tests for kohana.   If everything goes ok phpunit should print a series of dots (each dot represents a test that's passed) 
16 followed by something along the lines of `OK (520 tests, 1939 assertions)`.
18 If the result is instead something like `Ok but skipped or incomplete tests` then this just means that some tests were unable to run
19 on your system or their implementation is not quite finished.
21 By default code coverage is not calculated, if you want to collect it then you need to run `./phpunitcc` which will
22 run phpunit with the config in `code_coverage.xml`.  Once the tests have finished running open `code_coverage/index.html` 
23 in your browser.
25 Things to Test (TODO)
26 ---
28 * Need extra tests for Validate to make sure filters(), rules(), callbacks() will convert the field name to a label if a label
29   does not exist
31 Known failing tests
32 ---
34 NONE
36  * If any other tests fail for your system, please [file a bug](http://dev.kohanaframework.org/projects/kohana3/issues/new)