Phing和PHPUnit,连最基本的东西都不能运行 使用composer安装的bin

Phing和PHPUnit,连最基本的东西都不能运行 使用composer安装的bin,phpunit,phing,Phpunit,Phing,我正在执行一项最基本的任务,如下所示: <autoloader autoloaderpath="vendor/autoload.php"> <target name="asdf"> <echo msg="test"/> <phpunit configuration="app/phpunit.xml" haltonerror="true" haltonfa

我正在执行一项最基本的任务,如下所示:

<autoloader autoloaderpath="vendor/autoload.php">

<target name="asdf">
        <echo msg="test"/>
        <phpunit configuration="app/phpunit.xml"
                 haltonerror="true"
                 haltonfailure="true"
                 pharlocation="bin/phpunit"
        />
</target>
将导致:

  +Task: echo
    -calling setter EchoTask::setMsg()
     [echo] qwerqwer
  +Task: phpunit
    -calling setter PHPUnitTask::setConfiguration()
    -calling setter PHPUnitTask::setHaltonerror()
    -calling setter PHPUnitTask::setHaltonfailure()
    -calling setter PHPUnitTask::setPharLocation()
#!/usr/bin/env php
Cannot open file "asdf.php".
使用药物 使用相同的配置(位置除外):

  +Task: echo
    -calling setter EchoTask::setMsg()
     [echo] test
  +Task: phpunit
    -calling setter PHPUnitTask::setConfiguration()
    -calling setter PHPUnitTask::setHaltonerror()
    -calling setter PHPUnitTask::setHaltonfailure()

BUILD FINISHED
没有错误,但phpunit任务类型未启动

未识别选项 第三个简单的变体看起来不错,结果是“phpunit:unrecognedoption--p”,很遗憾我无法复制

版本
  • 普5.7
  • Phing 2.16
  • PHP7.1

    • 我看到您使用了PHPUnit 5.7。您在测试中使用名称空间了吗

      Phing的当前版本与诸如
      PHPUnit\Framework\TestCase
      之类的名称空间不兼容,您必须使用旧类
      \PHPUnit\u Framework\u TestCase

      下一个Phing版本将与PHPUnit的名称空间()兼容。同时,您可以创建
      phpunit.xml
      并将其添加到
      build.xml
      以运行测试:

      <target name="phpunit" description="Run tests">
          <exec executable="bin/phpunit" passthru="true">
              <arg value="--configuration"/>
              <arg value="app/phpunit.xml"/>
          </exec>
      </target>
      
      
      
      <target name="phpunit" description="Run tests">
          <exec executable="bin/phpunit" passthru="true">
              <arg value="--configuration"/>
              <arg value="app/phpunit.xml"/>
          </exec>
      </target>