PHPUnit参数详解:

    本文直接翻译自PHPUnit官方文档,个人翻译水平有限,可能会存在某些词和意思翻译不准的地方,进请谅解!

    Runs the tests that are provided by the class UnitTest. This class is expected to be declared in the UnitTest.php sourcefile.

    UnitTest must be either a class that inherits from PHPUnit_Framework_TestCase or a class that provides a public static suite() method which returns an PHPUnit_Framework_Test object, for example an instance of the PHPUnit_Framework_TestSuite class.
    运行类UnitTest提供的所有测试,这个类需要定义在UnitTest.php这个文件中.
    类UnitTest需要从PHPUnit_Framework_TestCase继承或者提供一个公开的静态方法suite()返回一个PHPUnit_Framework_Test对象的实例.
   
phpunit UnitTest Test.php
    Runs the tests that are provided by the class UnitTest. This class is expected to be declared in the specified sourcefile.
    运行UnitTest提供的所有测试,这个类应该在定义在Test.php中
   
--log-junit

    Generates a logfile in JUnit XML format for the tests run.
    生成JUnit XML格式的日志文件


--log-tap

    Generates a logfile using the Test Anything Protocol (TAP) format for the tests run.
    生成TAP格式的日志文件
   
--log-dbus

    Log test execution using DBUS.
    使用DBUS记录测试的执行情况


--log-json

    Generates a logfile using the JSON format.
    生成JSON格式的日志文件
   
--coverage-html

    Generates a code coverage report in HTML format.
    生成html格式的代码覆盖报告


    Please note that this functionality is only available when the tokenizer and Xdebug extensions are installed.
    请注意这个功能只能在tokenizer和Xdebug安装后才能使用


--coverage-clover

    Generates a logfile in XML format with the code coverage information for the tests run.
    生成xml格式的代码覆盖报告


    Please note that this functionality is only available when the tokenizer and Xdebug extensions are installed.
    请注意这个功能只能在tokenizer和Xdebug安装后才能使用


--testdox-html and --testdox-text

    Generates agile documentation in HTML or plain text format for the tests that are run.
    生成记录已运行测试的html或者纯文本格式的文件文档


--filter

    Only runs tests whose name matches the given pattern. The pattern can be either the name of a single test or a regular expression that matches multiple test names.


    只运行名字符合参数规定的格式的测试,参数可以是一个测试的名字或者一个匹配多个测试名字的正则表达式


--group

    Only runs tests from the specified group(s). A test can be tagged as belonging to a group using the @group annotation.
    只运行规定的测试组,一个测试可以使用@group注释来分组
    The @author annotation is an alias for @group allowing to filter tests based on their authors.
    @author注视是一个和@group关联的注释标签,用来根据作者来过滤测试


--exclude-group

    Exclude tests from the specified group(s). A test can be tagged as belonging to a group using the @group annotation.
    只包含规定的多个测试组,一个测试可以使用@group注释来分组


--list-groups

    List available test groups.
    列出可用的测试组
   
--loader

    Specifies the PHPUnit_Runner_TestSuiteLoader implementation to use.
    定义使用PHPUnit_Runner_TestSuiteLoader的接口


    The standard test suite loader will look for the sourcefile in the current working directory and in each directory that is specified in PHP's include_path configuration directive. Following the PEAR Naming Conventions, a class name such as Project_Package_Class is mapped to the sourcefile name Project/Package/Class.php.
    标准的standard test suite loader会在当前的目录和php的include_path中根据PEAR的命名规则的类,一个叫做Project_Package_Class的类 会指向到文件Project/Package/Class.php
   
--repeat

    Repeatedly runs the test(s) the specified number of times.
    根据定义的数字重复运行测试
   
--tap

    Reports the test progress using the Test Anything Protocol (TAP).
    使用Test Anything Protocol格式报告测试进程
   
--testdox

    Reports the test progress as agile documentation.
    使用agile documentation格式报告测试进程


--colors

    Use colors in output.
    在输出结果中使用颜色


--stderr

    Optionally print to STDERR instead of STDOUT.
    使用STDERR替代STDOUT输出结果


--stop-on-error

    Stop execution upon first error.
    在遇到第一个错误时停止执行
   
--stop-on-failure

    Stop execution upon first error or failure.
    在遇到第一个失败时停止执行
   
--stop-on-skipped

    Stop execution upon first skipped test.
    在遇到第一个跳过的测试时停止执行


--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语法错误,但是不会检查测试文件中引入的其他的代码文件的语法错误