Updated to KH 3.3 and improved

This commit is contained in:
Deon George
2013-04-13 16:17:56 +10:00
parent 6f50463ec7
commit 6f7913d363
1551 changed files with 96188 additions and 29813 deletions

View File

@@ -1,2 +1,3 @@
# Unittest
# UnitTest
Unit tests for Kohana

View File

@@ -1,5 +1,5 @@
## [UnitTest]()
- [Testing](testing)
- [Mock Objects](mockobjects)
- [Troubleshooting](troubleshooting)
- [Testing workflows](testing_workflows)
- [Mock Objects](mockobjects)
- [Testing](testing)
- [Testing workflows](testing_workflows)
- [Troubleshooting](troubleshooting)

View File

@@ -1,12 +1,12 @@
### From the command line
# Usage
$ phpunit --bootstrap=index.php modules/unittest/tests.php
$ phpunit --bootstrap=modules/unittest/bootstrap.php modules/unittest/tests.php
Of course, you'll need to make sure the path to the tests.php file is correct. If you want you can copy it to a more accessible location
Alternatively you can use a phpunit.xml to have a more fine grained control over which tests are included and which files are whitelisted.
### From the web
Make sure you only whitelist the highest files in the cascading filesystem, else you could end up with a lot of "class cannot be redefined" errors.
Just navigate to http://example.com/unittest. You may need to use http://example.com/index.php/unittest if you have not enabled url rewriting in your .htaccess.
If you use the tests.php testsuite loader then it will only whitelist the highest files. see config/unittest.php for details on configuring the tests.php whitelist.
## Writing tests
@@ -103,13 +103,13 @@ This functionality can be used to record which bug reports a test is for:
To see all groups that are available in your code run:
$ phpunit --boostrap=index.php --list-groups modules/unittest/tests.php
$ phpunit --boostrap=modules/unittest/bootstrap.php --list-groups modules/unittest/tests.php
*Note:* the `--list-groups` switch should appear before the path to the test suite loader
You can also exclude groups while testing using the `--exclude-group` switch. This can be useful if you want to ignore all kohana tests:
$ phpunit --bootstrap=index.php --exclude-group=kohana modules/unittest/tests.php
$ phpunit --bootstrap=modules/unittest/bootstrap.php --exclude-group=kohana modules/unittest/tests.php
For more info see:

View File

@@ -2,16 +2,6 @@
Having unittests for your application is a nice idea, but unless you actually use them they're about as useful as a chocolate firegaurd. There are quite a few ways of getting tests "into" your development process and this guide aims to cover a few of them.
## Testing through the webui
The web ui is a fairly temporary solution, aimed at helping developers get into unittesting and code coverage. Eventually it's hoped that people migrate on to the termainl & CI servers.
To access it goto
http://example.com/unittest/
*Note:* Your site will need to be in the correct environment in order to use the webui. See the config file for more details. You may also need to use http://example.com/index.php/unittest/
## Integrating with IDEs
Modern IDEs have come a long way in the last couple of years and ones like netbeans have pretty decent PHP / PHPUnit support.