{"id":30782,"date":"2022-07-03T03:13:26","date_gmt":"2023-11-03T11:29:17","guid":{"rendered":"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/"},"modified":"2025-08-12T20:47:55","modified_gmt":"2025-08-12T12:47:55","slug":"php-unit%e9%80%89%e9%a1%b9","status":"publish","type":"post","link":"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/","title":{"rendered":"PHP Unit\u9009\u9879"},"content":{"rendered":"<pre class=\"post-pre\"><code># .\/vendor\/bin\/phpunit --help\r\nPHPUnit 7.5.8 by Sebastian Bergmann and contributors.\r\n\r\nUsage: phpunit [options] UnitTest [UnitTest.php]\r\n       phpunit [options] &lt;directory&gt;\r\n\r\nCode Coverage Options:\r\n\r\n  --coverage-clover &lt;file&gt;    Generate code coverage report in Clover XML format\r\n  --coverage-crap4j &lt;file&gt;    Generate code coverage report in Crap4J XML format\r\n  --coverage-html &lt;dir&gt;       Generate code coverage report in HTML format\r\n  --coverage-php &lt;file&gt;       Export PHP_CodeCoverage object to file\r\n  --coverage-text=&lt;file&gt;      Generate code coverage report in text format\r\n                              Default: Standard output\r\n  --coverage-xml &lt;dir&gt;        Generate code coverage report in PHPUnit XML format\r\n  --whitelist &lt;dir&gt;           Whitelist &lt;dir&gt; for code coverage analysis\r\n  --disable-coverage-ignore   Disable annotations for ignoring code coverage\r\n  --no-coverage               Ignore code coverage configuration\r\n  --dump-xdebug-filter &lt;file&gt; Generate script to set Xdebug code coverage filter\r\n\r\nLogging Options:\r\n\r\n  --log-junit &lt;file&gt;          Log test execution in JUnit XML format to file\r\n  --log-teamcity &lt;file&gt;       Log test execution in TeamCity format to file\r\n  --testdox-html &lt;file&gt;       Write agile documentation in HTML format to file\r\n  --testdox-text &lt;file&gt;       Write agile documentation in Text format to file\r\n  --testdox-xml &lt;file&gt;        Write agile documentation in XML format to file\r\n  --reverse-list              Print defects in reverse order\r\n\r\nTest Selection Options:\r\n\r\n  --filter &lt;pattern&gt;          Filter which tests to run\r\n  --testsuite &lt;name,...&gt;      Filter which testsuite to run\r\n  --group ...                 Only runs tests from the specified group(s)\r\n  --exclude-group ...         Exclude tests from the specified group(s)\r\n  --list-groups               List available test groups\r\n  --list-suites               List available test suites\r\n  --list-tests                List available tests\r\n  --list-tests-xml &lt;file&gt;     List available tests in XML format\r\n  --test-suffix ...           Only search for test in files with specified\r\n                              suffix(es). Default: Test.php,.phpt\r\n\r\nTest Execution Options:\r\n\r\n  --dont-report-useless-tests Do not report tests that do not test anything\r\n  --strict-coverage           Be strict about @covers annotation usage\r\n  --strict-global-state       Be strict about changes to global state\r\n  --disallow-test-output      Be strict about output during tests\r\n  --disallow-resource-usage   Be strict about resource usage during small tests\r\n  --enforce-time-limit        Enforce time limit based on test size\r\n  --default-time-limit=&lt;sec&gt;  Timeout in seconds for tests without @small, @medium or @large\r\n  --disallow-todo-tests       Disallow @todo-annotated tests\r\n\r\n  --process-isolation         Run each test in a separate PHP process\r\n  --globals-backup            Backup and restore $GLOBALS for each test\r\n  --static-backup             Backup and restore static attributes for each test\r\n\r\n  --colors=&lt;flag&gt;             Use colors in output (\"never\", \"auto\" or \"always\")\r\n  --columns &lt;n&gt;               Number of columns to use for progress output\r\n  --columns max               Use maximum number of columns for progress output\r\n  --stderr                    Write to STDERR instead of STDOUT\r\n  --stop-on-defect            Stop execution upon first not-passed test\r\n  --stop-on-error             Stop execution upon first error\r\n  --stop-on-failure           Stop execution upon first error or failure\r\n  --stop-on-warning           Stop execution upon first warning\r\n  --stop-on-risky             Stop execution upon first risky test\r\n  --stop-on-skipped           Stop execution upon first skipped test\r\n  --stop-on-incomplete        Stop execution upon first incomplete test\r\n  --fail-on-warning           Treat tests with warnings as failures\r\n  --fail-on-risky             Treat risky tests as failures\r\n  -v|--verbose                Output more verbose information\r\n  --debug                     Display debugging information\r\n\r\n  --loader &lt;loader&gt;           TestSuiteLoader implementation to use\r\n  --repeat &lt;times&gt;            Runs the test(s) repeatedly\r\n  --teamcity                  Report test execution progress in TeamCity format\r\n  --testdox                   Report test execution progress in TestDox format\r\n  --testdox-group             Only include tests from the specified group(s)\r\n  --testdox-exclude-group     Exclude tests from the specified group(s)\r\n  --printer &lt;printer&gt;         TestListener implementation to use\r\n\r\n  --resolve-dependencies      Resolve dependencies between tests\r\n  --order-by=&lt;order&gt;          Run tests in order: default|reverse|random|defects|depends\r\n  --random-order-seed=&lt;N&gt;     Use a specific random seed &lt;N&gt; for random order\r\n  --cache-result              Write run result to cache to enable ordering tests defects-first\r\n\r\nConfiguration Options:\r\n\r\n  --prepend &lt;file&gt;            A PHP script that is included as early as possible\r\n  --bootstrap &lt;file&gt;          A PHP script that is included before the tests run\r\n  -c|--configuration &lt;file&gt;   Read configuration from XML file\r\n  --no-configuration          Ignore default configuration file (phpunit.xml)\r\n  --no-logging                Ignore logging configuration\r\n  --no-extensions             Do not load PHPUnit extensions\r\n  --include-path &lt;path(s)&gt;    Prepend PHP's include_path with given path(s)\r\n  -d key[=value]              Sets a php.ini value\r\n  --generate-configuration    Generate configuration file with suggested settings\r\n  --cache-result-file=&lt;file&gt;  Specify result cache path and filename\r\n\r\nMiscellaneous Options:\r\n\r\n  -h|--help                   Prints this usage information\r\n  --version                   Prints the version and exits\r\n  --atleast-version &lt;min&gt;     Checks that version is greater than min and exits\r\n  --check-version             Check whether PHPUnit is the latest version\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p># .\/vendor\/bin\/phpunit &#8211;help PHPUnit 7.5.8 by Sebastia [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[227],"class_list":["post-30782","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-227"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v21.5 (Yoast SEO v21.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PHP Unit\u9009\u9879 - Blog - Silicon Cloud<\/title>\n<meta name=\"description\" content=\"\u5173\u4e8ePHP Unit\u9009\u9879\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.silicloud.com\/zh\/blog\/php-unit\u9009\u9879\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PHP Unit\u9009\u9879\" \/>\n<meta property=\"og:description\" content=\"\u5173\u4e8ePHP Unit\u9009\u9879\u7684\u6280\u672f\u6587\u7ae0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.silicloud.com\/zh\/blog\/php-unit\u9009\u9879\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog - Silicon Cloud\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-03T11:29:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-12T12:47:55+00:00\" \/>\n<meta name=\"author\" content=\"\u96c5, \u609f\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"\u96c5, \u609f\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/\",\"name\":\"PHP Unit\u9009\u9879 - Blog - Silicon Cloud\",\"isPartOf\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\"},\"datePublished\":\"2023-11-03T11:29:17+00:00\",\"dateModified\":\"2025-08-12T12:47:55+00:00\",\"author\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\"},\"description\":\"\u5173\u4e8ePHP Unit\u9009\u9879\u7684\u6280\u672f\u6587\u7ae0\",\"breadcrumb\":{\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.silicloud.com\/zh\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PHP Unit\u9009\u9879\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#website\",\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/\",\"name\":\"Blog - Silicon Cloud\",\"description\":\"\",\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6\",\"name\":\"\u96c5, \u609f\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g\",\"caption\":\"\u96c5, \u609f\"},\"url\":\"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/\"},{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/#local-main-organization-logo\",\"url\":\"\",\"contentUrl\":\"\",\"caption\":\"Blog - Silicon Cloud\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"PHP Unit\u9009\u9879 - Blog - Silicon Cloud","description":"\u5173\u4e8ePHP Unit\u9009\u9879\u7684\u6280\u672f\u6587\u7ae0","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.silicloud.com\/zh\/blog\/php-unit\u9009\u9879\/","og_locale":"zh_CN","og_type":"article","og_title":"PHP Unit\u9009\u9879","og_description":"\u5173\u4e8ePHP Unit\u9009\u9879\u7684\u6280\u672f\u6587\u7ae0","og_url":"https:\/\/www.silicloud.com\/zh\/blog\/php-unit\u9009\u9879\/","og_site_name":"Blog - Silicon Cloud","article_published_time":"2023-11-03T11:29:17+00:00","article_modified_time":"2025-08-12T12:47:55+00:00","author":"\u96c5, \u609f","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"\u96c5, \u609f"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/","url":"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/","name":"PHP Unit\u9009\u9879 - Blog - Silicon Cloud","isPartOf":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website"},"datePublished":"2023-11-03T11:29:17+00:00","dateModified":"2025-08-12T12:47:55+00:00","author":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6"},"description":"\u5173\u4e8ePHP Unit\u9009\u9879\u7684\u6280\u672f\u6587\u7ae0","breadcrumb":{"@id":"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.silicloud.com\/zh\/blog\/"},{"@type":"ListItem","position":2,"name":"PHP Unit\u9009\u9879"}]},{"@type":"WebSite","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#website","url":"https:\/\/www.silicloud.com\/zh\/blog\/","name":"Blog - Silicon Cloud","description":"","inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/f044a4b7fa4ee2701702942002419ca6","name":"\u96c5, \u609f","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/e71a913e914f1aad1efc391f92084294bac54bc782acd289638580134cf667a6?s=96&d=mm&r=g","caption":"\u96c5, \u609f"},"url":"https:\/\/www.silicloud.com\/zh\/blog\/author\/yawu\/"},{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.silicloud.com\/zh\/blog\/php-unit%e9%80%89%e9%a1%b9\/#local-main-organization-logo","url":"","contentUrl":"","caption":"Blog - Silicon Cloud"}]}},"_links":{"self":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/30782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/comments?post=30782"}],"version-history":[{"count":1,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/30782\/revisions"}],"predecessor-version":[{"id":52449,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/posts\/30782\/revisions\/52449"}],"wp:attachment":[{"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/media?parent=30782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/categories?post=30782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.silicloud.com\/zh\/blog\/wp-json\/wp\/v2\/tags?post=30782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}