PHPackages                             cedriclange/ci-phpunit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. cedriclange/ci-phpunit

ActiveLibrary[Testing &amp; Quality](/categories/testing)

cedriclange/ci-phpunit
======================

An easier way to use PHPUnit with CodeIgniter 3.x

v0.17.5(6y ago)079MITPHPPHP &gt;=5.4.0

Since Apr 2Pushed 6y ago1 watchersCompare

[ Source](https://github.com/cedriclange/ci-phpunit)[ Packagist](https://packagist.org/packages/cedriclange/ci-phpunit)[ Docs](http://kenjis.github.io/ci-phpunit-test/)[ RSS](/packages/cedriclange-ci-phpunit/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

phpunit

this repo has been build to solve issues #34 and #311

An easier way to use PHPUnit with [CodeIgniter](https://github.com/bcit-ci/CodeIgniter) 3.x.

- You don't have to modify CodeIgniter core files at all.
- You can write controller tests easily.
- Nothing is untestable, maybe.
- Well documented.

[![Screenshot: Running tests on NetBeans 8.1](https://camo.githubusercontent.com/53d6ba530de9cbec9e820d47ddf3eb6c993d83a14948eafe6427ba77fbb9d62a/68747470733a2f2f7062732e7477696d672e636f6d2f6d656469612f4355556d68785756414141777833622e706e67)](https://camo.githubusercontent.com/53d6ba530de9cbec9e820d47ddf3eb6c993d83a14948eafe6427ba77fbb9d62a/68747470733a2f2f7062732e7477696d672e636f6d2f6d656469612f4355556d68785756414141777833622e706e67)

Requirements
------------

[](#requirements)

- PHP 5.4.0 or later (5.6 or later is recommended)
- CodeIgniter 3.x
- PHPUnit 4.3 to 7.5 (4.8 or later is recommended)
    - If you want to use PHPUnit 8 or later, please use ci-phpunit-test [2.x](https://github.com/kenjis/ci-phpunit-test/tree/2.x).
    - If you use PHPUnit 6.0, please use ci-phpunit-test v0.14.0 or later.
    - You can download old version of `phpunit.phar` from .

Optional
--------

[](#optional)

- NetBeans
    - Go to *Project Properties &gt; Testing &gt; PHPUnit*, check *Use Custom Test Suite* checkbox, and select `application/tests/_ci_phpunit_test/TestSuiteProvider.php`.

Change Log
----------

[](#change-log)

See [Change Log](https://github.com/kenjis/ci-phpunit-test/blob/master/application/tests/_ci_phpunit_test/ChangeLog.md).

Folder Structure
----------------

[](#folder-structure)

```
codeigniter/
├── application/
│   └── tests/
│        ├── _ci_phpunit_test/ ... don't touch! files ci-phpunit-test uses
│        ├── Bootstrap.php     ... bootstrap file for PHPUnit
│        ├── DbTestCase.php    ... DbTestCase class
│        ├── TestCase.php      ... TestCase class
│        ├── controllers/      ... put your controller tests
│        ├── libraries/        ... put your library tests
│        ├── mocks/
│        │   └── libraries/    ... mock libraries
│        ├── models/           ... put your model tests
│        └── phpunit.xml       ... config file for PHPUnit
└── vendor/

```

Installation
------------

[](#installation)

### Installation via Composer

[](#installation-via-composer)

If you like Composer:

```
$ cd /path/to/codeigniter/
$ composer require cedriclange/ci-phpunit --dev

```

And run `install.php`:

```
$ php vendor/cedric/ci-phpunit/install.php --from-composer

```

- The above command always overwrites existing files.
- You must run it at CodeIgniter project root folder.
- Please remove the line `./_ci_phpunit_test/` in [tests/phpunit.xml](https://github.com/kenjis/ci-phpunit-test/blob/master/application/tests/phpunit.xml#L8).
- You can specify your `application` and `public` folder with option arguments, if you use custom folder paths.

```
$ php vendor/cedriclange/ci-phpunit/install.php -a  -p

```

- But some paths may be not correct, in that case, please fix them in [tests/Bootstrap.php](https://github.com/kenjis/ci-phpunit-test/blob/master/application/tests/Bootstrap.php#L96).

### Upgrading via Composer

[](#upgrading-via-composer)

If you like Composer:

```
$ cd /path/to/codeigniter/
$ composer update cedriclange/ci-phpunit

```

If you're upgrading from a previous version of `ci-phpunit-test` that created an `application/test/_ci_phpunit_test` directory and now want to directly use `ci-phpunit-test` from Composer, you have a couple of additional steps:

1. Delete the old test library directory: `rm -rf /path/to/codeigniter/application/tests/_ci_phpunit_test`
2. Edit the `application/tests/Bootstrap.php` file. At the bottom of the "set the main path constants"

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2232d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a3c1028583a63aaa461542583505d749ccb0e28678e21b3b09e5ddce53aec530?d=identicon)[cedriclange](/maintainers/cedriclange)

---

Top Contributors

[![cedriclange](https://avatars.githubusercontent.com/u/22542802?v=4)](https://github.com/cedriclange "cedriclange (4 commits)")

---

Tags

phpunittestunit testingcodeignitermonkey patch

### Embed Badge

![Health badge](/badges/cedriclange-ci-phpunit/health.svg)

```
[![Health](https://phpackages.com/badges/cedriclange-ci-phpunit/health.svg)](https://phpackages.com/packages/cedriclange-ci-phpunit)
```

###  Alternatives

[kenjis/ci-phpunit-test

An easier way to use PHPUnit with CodeIgniter 3.x

5861.2M3](/packages/kenjis-ci-phpunit-test)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[atoum/atoum

Simple modern and intuitive unit testing framework for PHP 8.0+

1.4k2.6M311](/packages/atoum-atoum)[ta-tikoma/phpunit-architecture-test

Methods for testing application architecture

10745.9M13](/packages/ta-tikoma-phpunit-architecture-test)[php-mock/php-mock-phpunit

Mock built-in PHP functions (e.g. time()) with PHPUnit. This package relies on PHP's namespace fallback policy. No further extension is needed.

1718.2M399](/packages/php-mock-php-mock-phpunit)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
