🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
1. 编辑 `composer.json` 文件 ~~~ { "name": "topthink/think", "description": "the new thinkphp framework", "type": "project", "keywords": [ "framework", "thinkphp", "ORM" ], "homepage": "http://thinkphp.cn/", "license": "Apache-2.0", "authors": [ { "name": "liu21st", "email": "liu21st@gmail.com" } ], "require": { "php": ">=5.4.0", "topthink/framework": "^5.0", "topthink/think-image": "dev-master", "topthink/think-testing": "1.*", "phpoffice/phpexcel" : "1.8.1", "php-curl-class/php-curl-class": "^7.4", "gongfangjun/file-manager": "*" }, "extra": { "think-path": "thinkphp" }, "config": { "preferred-install": "dist" }, "repositories": { "packagist": { "type": "composer", "url": "https://packagist.phpcomposer.com" } } } ~~~ 2. 增加`ThinkPHP5`的单元测试扩展 ~~~ "topthink/think-testing": "1.*", ~~~ 3. composer安装扩展 ~~~ D:\phpStudy\WWW\workspace\DragonApi>php composer.phar update Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 22 installs, 0 updates, 0 removals - Installing symfony/polyfill-mbstring (v1.6.0): Downloading (100%) - Installing symfony/dom-crawler (v2.8.32): Downloading (100%) - Installing symfony/yaml (v2.8.32): Downloading (100%) - Installing sebastian/version (1.0.6): Downloading (100%) - Installing sebastian/global-state (1.1.1): Downloading (100%) - Installing sebastian/recursion-context (1.0.5): Downloading (100%) - Installing sebastian/exporter (1.2.2): Downloading (100%) - Installing sebastian/environment (1.3.8): Downloading (100%) - Installing sebastian/diff (1.4.3): Downloading (100%) - Installing sebastian/comparator (1.2.4): Downloading (100%) - Installing doctrine/instantiator (1.0.5): Downloading (100%) - Installing phpunit/php-text-template (1.2.1): Downloading (100%) - Installing phpunit/phpunit-mock-objects (2.3.8): Downloading (100%) - Installing phpunit/php-timer (1.0.9): Downloading (100%) - Installing phpunit/php-file-iterator (1.4.5): Downloading (100%) - Installing phpunit/php-token-stream (1.4.12): Downloading (100%) - Installing phpunit/php-code-coverage (2.2.4): Downloading (100%) - Installing phpdocumentor/reflection-docblock (2.0.5): Downloading (100%) - Installing phpspec/prophecy (1.7.3): Downloading (100%) - Installing phpunit/phpunit (4.8.36): Downloading (100%) - Installing topthink/think-helper (v1.0.6): Downloading (100%) - Installing topthink/think-testing (v1.0.6): Downloading (100%) symfony/dom-crawler suggests installing symfony/css-selector () sebastian/global-state suggests installing ext-uopz (*) phpunit/phpunit-mock-objects suggests installing ext-soap (*) phpunit/php-code-coverage suggests installing ext-xdebug (>=2.2.1) phpdocumentor/reflection-docblock suggests installing dflydev/markdown (~1.0) phpdocumentor/reflection-docblock suggests installing erusev/parsedown (~1.0) phpunit/phpunit suggests installing phpunit/php-invoker (~1.1) Writing lock file Generating autoload files D:\phpStudy\WWW\workspace\DragonApi> ~~~ 在TP安装目录下运行命令,测试一下安装是否成功:`php think unit` ~~~ D:\phpStudy\WWW\workspace\DragonApi>php think unit PHPUnit 4.8.36 by Sebastian Bergmann and contributors. .. Time: 755 ms, Memory: 5.75MB OK (2 tests, 4 assertions) ~~~ 如果出现上面的信息,则说明安装成功。