PHPUnit教程(五)PHPUnit参数详解

发布时间:2020-01-02编辑:脚本学堂
本文是PHPUnit系列教程的第五篇,详细介绍了PHPUnit中的参数用法,有需要的朋友作个参考。

本节是 PHPUnit教程(五)PHPUnit参数详解 第二部分的内容,大家可以继续阅读。
--stop-on-incomplete

    Stop execution upon first incomplete test.
    在遇到第一个未完成的测试时停止执行

--strict

    Mark a test as incomplete if no assertions are made.
    当一个测试没有定义任何断言时将其标记为未完成的测试

--verbose

    Output more verbose information, for instance the names of tests that were incomplete or have been skipped.
    输出例如未完成的测试的名字,跳过的测试的名字

--wait

    Waits for a keystroke after each test. This is useful if you are running the tests in a window that stays open only as long as the test runner is active.
    在每个测试开始之前等待用户按键,这个在你一个保持打开的窗口中运行很长的测试时很有帮助

--skeleton-class

    Generates a skeleton class Unit (in Unit.php) from a test case class UnitTest (in UnitTest.php).
    从一个测试类中生成一个概要测试类
   
--skeleton-test

    Generates a skeleton test case class UnitTest (in UnitTest.php) for a class Unit (in Unit.php). See Chapter 17 for more details.
    在Unit.php内为类Unit生成一个概要测试类UnitTest

--process-isolation

    Run each test in a separate PHP process.
    在多个php进程中运行所有测试

--no-globals-backup

    Do not backup and restore $GLOBALS.
    不备份和还原$GLOBALS变量

--static-backup

    Backup and restore static attributes of user-defined classes.
    备份和还原用户定义的类中的静态变量

--syntax-check

    Enables the syntax check of test source files.
    对测试的代码文件开启语法检查

--bootstrap

    A "bootstrap" PHP file that is run before the tests.
    定义测试前运行的bootstrap的php文件的路径

--configuration, -c

    Read configuration from XML file. See Appendix C for more details.
    从xml文件中读取配置,增加-c参数看更多的内容

    If phpunit.xml or phpunit.xml.dist (in that order) exist in the current working directory and --configuration is not used, the configuration will be automatically read from that file.
    如果phpunit.xml或phpunit.xml.dist(根据这个模式)在当前的目录中存在且--configuration参数没有使用的时候,配置信息会被自动读取

--no-configuration

    Ignore phpunit.xml and phpunit.xml.dist from the current working directory.
    自动跳过当前目录的phpunit.xml和phpunit.xml.dist配置文件

--include-path

    Prepend PHP's include_path with given path(s).
    在php的include_path增加路径

-d

    Sets the value of the given PHP configuration option.
    定义php的配置属性

--debug

    Output debug information such as the name of a test when its execution starts.
    输出调试信息如测试的名称及该测试什么时候开始执行
   
Note
提示
When the tested code contains PHP syntax errors, the TextUI test runner might exit without printing error information.
The standard test suite loader can optionally check the test suite sourcefile for PHP syntax errors, but not sourcefiles included by the test suite sourcefile.
当测试代码中含有php语法错误的时候,测试器会退出且不会打印任何错误信息,standard test suite loader可选择性检查测试文件源代码的PHP语法错误,但是不会检查测试文件中引入的其他的代码文件的语法错误。