Automatically running PHPUnit tests with Arcanist (Phabricator)

流过昼夜 提交于 2019-12-05 13:14:00

The documentation you linked won't be very useful - it's aimed at Phabricator developers who want to test their libraries. There is some user-facing documentation for customising unit test tasks, but it's not great. Fortunately, it's quite easy to get Arcanist to run your project's unit tests using the included PhpunitTestEngine:

  1. Prepare a phpunit.xml file in your project root. This should be a standard PHPUnit configuration file. You can test this by running phpunit -c phpunit.xml.
  2. Add a phpunit_config option to your .arcconfig:

    {
      "phabricator.uri": "https://phabricator.xxx.xxx.net/",
      "unit.engine": "PhpunitTestEngine",
      "phpunit_config": "phpunit.xml"
    }
    
  3. Run arc unit to test it out.

Although user documentation is thin on the ground, the source code for PhpunitTestEngine has some comments and is fairly concise. If you run into problems, reading through the test engine code can help you track it down.

$ arc unit --help

  unit [options] [paths]
  unit [options] --rev [rev]
      Supports: git, svn, hg
      Run unit tests that cover specified paths. If no paths are specified,
      unit tests covering all modified files will be run.

By default, arc lint and arc unit are meant to be used as part of a process of making changes, so by default it only acts on changed files. Odds are, you don't have any changed files. You probably want to specify some paths, or run arc unit --everything to run all tests.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!