Alexandr Smirnov f841c3033a Fix unittest 23.05.2024 4 months ago
..
classes f841c3033a Fix unittest 23.05.2024 4 months ago
config 80c216b900 fix the ability to make code coverage reports 6 years ago
guide 80c216b900 fix the ability to make code coverage reports 6 years ago
README.markdown 5fc5366ea3 remove old unittest files and lines 6 years ago
bootstrap.php 72af61f961 Merge pull request #225 from errotan/cachefix 6 years ago
example.phpunit.xml ab01632e95 initial commit from 3.3.5 + exception.php comaptible with PHP7 8 years ago
tests.php ab01632e95 initial commit from 3.3.5 + exception.php comaptible with PHP7 8 years ago

README.markdown

Kohana-PHPUnit integration

This module integrates PHPUnit with Kohana and is used to run all the core Kohana tests. In most cases you will not need to use this module for testing your own projects. If there are particular helpers provided here that you rely on, that may be a sign that your own code is too closely coupled to the behaviour of the Kohana core classes.

If you look through any of the tests provided in this module you'll probably notice all theHorribleCamelCase. I've chosen to do this because it's part of the PHPUnit coding conventions and is required for certain features such as auto documentation.

Requirements and installation

Dependencies are listed in the composer.json - run composer install to install the module and all external requirements. Note that more usually you will add this module to your own module's composer.json:

{
  "require-dev": {
    "kohana/unittest": "3.3.*@dev"
  }
}

Usage

$ phpunit --bootstrap=modules/unittest/bootstrap.php modules/unittest/tests.php

Alternatively you can use a phpunit.xml to have a more fine grained control over which tests are included and which files are whitelisted.

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.

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.