PHPackages                             zt/unit-test - 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. zt/unit-test

ActiveLibrary

zt/unit-test
============

Thinkphp Unit Test

1.2(9y ago)262818MITPHPPHP &gt;=5.3.0

Since Dec 26Pushed 9y ago3 watchersCompare

[ Source](https://github.com/hizt/ThinkPHPUnit)[ Packagist](https://packagist.org/packages/zt/unit-test)[ Docs](https://github.com/hizt/ThinkPHPUnit)[ RSS](/packages/zt-unit-test/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

ThinkPHPUnit v0.95
==================

[](#thinkphpunit-v095)

一个为ThinkPHP打造的的UnitTest，简单易用、高效便捷。

\##How To Use

### 详细使用介绍查看项目`example`,下面列出一个简单的使用介绍

[](#详细使用介绍查看项目example下面列出一个简单的使用介绍)

- 在`Application`目录下创建`Test/Controller`，编写测试Controller。
- 以编写 IndexController为例:

```
namespace \Test\Controller;
class IndexController extends UnitTest{

    /**
     *   调用方法：
     *   1. http://localhost/PROJECT_NAME/index.php?m=Test  自动执行全部测试文件
     *   2. http://localhost/PROJECT_NAME/index.php?m=Test&controller=XXX  自动执行参数crontroller指定的文件
     */
    function index(){
        $this->run(true); //测试方式1 ： 通过自动遍历测试文件的方式执行测试

    }

    function index2(){
        $this->setController( array(__CLASS__ ,'\OtherClassName') );  //测试方式2 ：设置将要执行的测试类
        $this->run();                               //执行测试代码

    }

    function testExample1(){                    //该方法将自动被测试
        $this->assertTrue(true);
        $this->assertFalse(false);
    }

    function testExample2(){                    //该方法将自动被测试
            $this->assertEmpty(null);
            $this->assertNotEmpty(true);
    }
}
```

- 到浏览器运行 `http://localhost/PROJECT_PATH/index.php?m=Test`
- 运行结果 [![IMG](https://raw.githubusercontent.com/hizt/ThinkPHPUnit/master/result-screenshot.png)](https://raw.githubusercontent.com/hizt/ThinkPHPUnit/master/result-screenshot.png)

\##Bug &amp;&amp; Contact Author

- bug提交：
- 作者：

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3421d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

unittestthinkphp

### Embed Badge

![Health badge](/badges/zt-unit-test/health.svg)

```
[![Health](https://phpackages.com/badges/zt-unit-test/health.svg)](https://phpackages.com/packages/zt-unit-test)
```

###  Alternatives

[topthink/think

the new thinkphp framework

8.0k1.2M13](/packages/topthink-think)[topthink/framework

The ThinkPHP Framework.

2.8k3.2M1.3k](/packages/topthink-framework)[thinkcmf/thinkcmf

ThinkCMF based on ThinkPHP 8.x , it is a free and open source Content Management Framework(CMF)

2.2k19.3k](/packages/thinkcmf-thinkcmf)[rregeer/phpunit-coverage-check

Check the code coverage using the clover report of phpunit

606.1M179](/packages/rregeer-phpunit-coverage-check)[casbin/think-authz

An authorization library that supports access control models like ACL, RBAC, ABAC for ThinkPHP.

27918.5k6](/packages/casbin-think-authz)[friendsofcake/fixturize

CakePHP Fixture classes to help increase productivity or performance

24504.7k1](/packages/friendsofcake-fixturize)

PHPackages © 2026

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