cedriclange/ci-phpunit 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

cedriclange/ci-phpunit

Composer 安装命令:

composer require cedriclange/ci-phpunit

包简介

An easier way to use PHPUnit with CodeIgniter 3.x

README 文档

README

phpunit

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

An easier way to use PHPUnit with 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

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.
    • 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 https://phar.phpunit.de/.

Optional

  • NetBeans
    • Go to Project Properties > Testing > PHPUnit, check Use Custom Test Suite checkbox, and select application/tests/_ci_phpunit_test/TestSuiteProvider.php.

Change Log

See Change Log.

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 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 <exclude>./_ci_phpunit_test/</exclude> in tests/phpunit.xml.
  • 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 <application_dir> -p <public_dir>

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"

统计信息

  • 总下载量: 79
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固