PHPUnit Watcher 使用教程

PHPUnit Watcher 使用教程

phpunit-watcherA tool to automatically rerun PHPUnit tests when source code changes项目地址:https://gitcode.com/gh_mirrors/ph/phpunit-watcher

1. 项目的目录结构及介绍

PHPUnit Watcher 是一个用于自动重新运行 PHPUnit 测试的工具,当源代码发生变化时。以下是该项目的目录结构及其介绍:

phpunit-watcher/
├── bin/
│   └── phpunit-watcher
├── config/
│   └── phpunit-watcher.js
├── src/
│   ├── Commands/
│   │   └── WatchCommand.php
│   ├── Services/
│   │   └── Watcher.php
│   └── phpunit-watcher.php
├── tests/
│   └── TestCase.php
├── .gitignore
├── composer.json
├── LICENSE
├── README.md
└── phpunit.xml
  • bin/: 包含可执行文件 phpunit-watcher
  • config/: 包含配置文件 phpunit-watcher.js
  • src/: 包含项目的源代码,包括命令和服务的实现。
  • tests/: 包含测试用例。
  • .gitignore: Git 忽略文件。
  • composer.json: Composer 依赖管理文件。
  • LICENSE: 项目许可证。
  • README.md: 项目说明文档。
  • phpunit.xml: PHPUnit 配置文件。

2. 项目的启动文件介绍

项目的启动文件位于 bin/ 目录下,名为 phpunit-watcher。这个文件是一个可执行脚本,用于启动 PHPUnit Watcher 工具。

#!/usr/bin/env php
<?php

require __DIR__.'/../vendor/autoload.php';

use Spatie\PhpUnitWatcher\Console\Commands\WatchCommand;
use Symfony\Component\Console\Application;

$application = new Application();
$application->add(new WatchCommand());
$application->run();

这个脚本首先加载 Composer 自动加载文件,然后创建一个 Symfony Console 应用程序实例,并添加 WatchCommand 命令,最后运行应用程序。

3. 项目的配置文件介绍

项目的配置文件位于 config/ 目录下,名为 phpunit-watcher.js。这个文件用于配置 PHPUnit Watcher 的行为。

module.exports = {
    watch: [
        'app',
        'src',
        'tests'
    ],
    phpunit: {
        binary: 'vendor/bin/phpunit',
        arguments: []
    }
};
  • watch: 指定要监视的目录或文件。
  • phpunit: 包含 PHPUnit 的二进制文件路径和运行时参数。

通过修改这个配置文件,可以自定义 PHPUnit Watcher 监视的目录和 PHPUnit 的运行参数。


以上是 PHPUnit Watcher 项目的目录结构、启动文件和配置文件的介绍。希望这份教程能帮助你更好地理解和使用这个工具。

phpunit-watcherA tool to automatically rerun PHPUnit tests when source code changes项目地址:https://gitcode.com/gh_mirrors/ph/phpunit-watcher

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

苏钥凤Magdalene

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值