PHPackages                             nueip/codeigniter-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. nueip/codeigniter-phpunit

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

nueip/codeigniter-phpunit
=========================

CodeIgniter 3 PHPUnit Test extension library

1.3.0(4y ago)041MITPHP

Since Apr 30Pushed 4y agoCompare

[ Source](https://github.com/nueip/codeigniter-phpunit)[ Packagist](https://packagist.org/packages/nueip/codeigniter-phpunit)[ Docs](https://github.com/nueip/codeigniter-phpunit)[ RSS](/packages/nueip-codeigniter-phpunit/feed)WikiDiscussions nueip Synced 1w ago

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

 [ ![](https://camo.githubusercontent.com/5b8d9090a678d487fbff6d0d7400659c2180a80374753a34de65cc380c2e2dca/68747470733a2f2f636f646569676e697465722e636f6d2f6173736574732f696d616765732f63692d6c6f676f2d6269672e706e67) ](https://codeigniter.com/)

CodeIgniter PHPUnit Test
========================

[](#codeigniter-phpunit-test)

CodeIgniter 3 PHPUnit Test extension library

[![Latest Stable Version](https://camo.githubusercontent.com/708163366e6ee9e033a1f7ca716b05f37e782600a7ce0c62949701e2e8bc6dbf/68747470733a2f2f706f7365722e707567782e6f72672f6e756569702f636f646569676e697465722d706870756e69742f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/nueip/codeigniter-phpunit)[![License](https://camo.githubusercontent.com/e219c8e0c75e5175f53f768cd7911af12ff0cfbd97befa946c6bbe990b5bc5de/68747470733a2f2f706f7365722e707567782e6f72672f6e756569702f636f646569676e697465722d706870756e69742f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/nueip/codeigniter-phpunit)

This RESTful API extension is collected into [nueip/codeigniter-pack](https://github.com/nueip/codeigniter-pack) which is a complete solution for Codeigniter framework.

FEATURES
--------

[](#features)

- ***PHPUnit Test** in **Codeigniter 3** Framework*
- *Easy to install into your Codeigniter project by Composer*

---

OUTLINE
-------

[](#outline)

- [FEATURES](#features)
- [OUTLINE](#outline)
- [REQUIREMENTS](#requirements)
- [INSTALLATION](#installation)
- [DIRECTORY STRUCTURE](#directory-structure)
- [CONFIGURATION](#configuration)
- [USAGE](#usage)
- [TEST CASE](#test-case)

REQUIREMENTS
------------

[](#requirements)

This library requires the following:

- PHP 5.3.0+
- CodeIgniter 3.0.0+

---

INSTALLATION
------------

[](#installation)

Run Composer in your Codeigniter project under the folder `\application`:

```
composer require nueip/codeigniter-phpunit

```

---

DIRECTORY STRUCTURE
-------------------

[](#directory-structure)

```
codeigniter/
└── application/
    ├── tests/          Test cases
    ├── vendor/         Vendor included nueip/codeigniter-phpunit
    └── phpunit.xml     PHPUnit XML

```

---

CONFIGURATION
-------------

[](#configuration)

According to [Directory Structure](#directory-structure), create and configure `phpunit.xml` under `application` directory:

```

      tests

```

For this `phpunit.xml` template, the test cases directory is `application/test`, make sure you would create every test cases under it.

---

USAGE
-----

[](#usage)

In the `application` directory of this library, run `phpunit` from vendor:

```
$ ./vendor/bin/phpunit

```

Or using absolute path commands like:

```
$ /var/www/html/codeigniter3/application/vendor/bin/phpunit -c /var/www/html/codeigniter3/application/phpunit.xml
$ phpunit -c /var/www/html/codeigniter3/application/phpunit.xml

```

Then the result would like:

```
PHPUnit 5.7.27 by Sebastian Bergmann and contributors.

Time: 40 ms, Memory: 2.75MB

No tests executed!
```

---

TEST CASE
---------

[](#test-case)

With this extension libaray, you could write test cases with loading Codeigniter framework.

For example, write a test case `application/tests/CodeigniterTest.php` for testing Codeigniter config component:

```
