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

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

yidas/codeigniter-phpunit
=========================

CodeIgniter 3 PHPUnit Test extension library

1.1.0(7y ago)1692.9k—9.9%102MITPHP

Since Apr 30Pushed 7y ago1 watchersCompare

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

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

 [ ![](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/f85356e1a330da31f9a08e863bfc329288169ff353798d5612c519f8879c6d4e/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f636f646569676e697465722d706870756e69742f762f737461626c653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/codeigniter-phpunit)[![License](https://camo.githubusercontent.com/ce6b2ff4d588499bab683a378e38d63e1c34a8002617c1e8750a52c732a16e62/68747470733a2f2f706f7365722e707567782e6f72672f79696461732f636f646569676e697465722d706870756e69742f6c6963656e73653f666f726d61743d666c61742d737175617265)](https://packagist.org/packages/yidas/codeigniter-phpunit)

This RESTful API extension is collected into [yidas/codeigniter-pack](https://github.com/yidas/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)

- [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 yidas/codeigniter-phpunit

```

---

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

[](#directory-structure)

```
codeigniter/
└── application/
    ├── tests/          Test cases
    ├── vendor/         Vendor included yidas/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:

```
