Skip to content

Commit

Permalink
Merge 3.3/release/3.3.3 into 3.3/master
Browse files Browse the repository at this point in the history
  • Loading branch information
enov committed Dec 11, 2014
2 parents 8db01f0 + 5cc6000 commit bb99637
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
*~
*.swp
composer.lock
vendor/*
koharness_bootstrap.php

18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: php

php:
- 5.3
- 5.4
- 5.5
- 5.6
- hhvm

before_script:
- composer install --prefer-dist
- vendor/bin/koharness

script:
- cd /tmp/koharness && ./vendor/bin/phpunit --bootstrap=modules/unittest/bootstrap.php modules/unittest/tests.php

notifications:
email: false
22 changes: 19 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
# Kohana-PHPUnit integration

This module integrates PHPUnit with Kohana.
| ver | Stable | Develop |
|-------|--------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
| 3.3.x | [![Build Status - 3.3/master](https://travis-ci.org/kohana/unittest.svg?branch=3.3%2Fmaster)](https://travis-ci.org/kohana/unittest) | [![Build Status - 3.3/develop](https://travis-ci.org/kohana/unittest.svg?branch=3.3%2Fdevelop)](https://travis-ci.org/kohana/unittest) |
| 3.4.x | [![Build Status - 3.4/master](https://travis-ci.org/kohana/unittest.svg?branch=3.4%2Fmaster)](https://travis-ci.org/kohana/unittest) | [![Build Status - 3.4/develop](https://travis-ci.org/kohana/unittest.svg?branch=3.4%2Fdevelop)](https://travis-ci.org/kohana/unittest) |

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
## 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:

* [PHPUnit](http://www.phpunit.de/) >= 3.4
```json
{
"require-dev": {
"kohana/unittest": "3.3.*@dev"
}
}
```

## Usage

Expand Down
9 changes: 7 additions & 2 deletions bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,10 @@
}
}

// Enable the unittest module
Kohana::modules(Kohana::modules() + array('unittest' => MODPATH.'unittest'));
// Enable the unittest module if it is not already loaded - use the absolute path
$modules = Kohana::modules();
$unittest_path = realpath(__DIR__).DIRECTORY_SEPARATOR;
if ( ! in_array($unittest_path, $modules)) {
$modules['unittest'] = $unittest_path;
Kohana::modules($modules);
}
2 changes: 1 addition & 1 deletion bootstrap_all_modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

foreach ($modules_iterator as $module)
{
if ($module->isDir())
if ($module->isDir() AND ! $module->isDot())
{
$modules[$module->getFilename()] = MODPATH.$module->getFilename();
}
Expand Down
2 changes: 1 addition & 1 deletion classes/Kohana/Unittest/Database/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php defined('SYSPATH') or die('No direct script access.');
/**
* TestCase for testing a database
*
Expand Down
2 changes: 1 addition & 1 deletion classes/Kohana/Unittest/Helpers.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php defined('SYSPATH') or die('No direct script access.');

/**
* Unit testing helpers
Expand Down
2 changes: 1 addition & 1 deletion classes/Unittest/Database/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php defined('SYSPATH') or die('No direct script access.');

/**
* Transparent extension for Kohana_Unittest_Database_TestCase
Expand Down
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@
"php": ">=5.3.3",
"phpunit/phpunit": "3.7.*"
},
"require-dev": {
"kohana/core": "3.3.*@dev",
"kohana/koharness": "*@dev"
},
"extra": {
"branch-alias": {
"dev-3.3/develop": "3.3.x-dev",
"dev-3.4/develop": "3.4.x-dev"
}
},
"installer-paths": {
"vendor/{$vendor}/{$name}": ["type:kohana-module"]
}
}
}
7 changes: 7 additions & 0 deletions koharness.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
// Configuration for koharness - builds a standalone skeleton Kohana app for running unit tests
return array(
'modules' => array(
'unittest' => __DIR__
),
);

0 comments on commit bb99637

Please sign in to comment.