Phpunit查找错误的文件夹或失败,说composer isn't安装


phpunit looks in wrong folder or fails, saying composer isn't installed

我试图通过Mac(10.10.5)上的符号链接运行phpunit

Composer是自我更新的(c85894e7920c5e83d93d88b541bc4ebf), phpunit版本为"4.4.5"。

我有如下的文件结构(简化):

'library
  'composer
    'vendor
      'bin
        'phpunit (symlink to '../phpunit/phpunit/phpunit')
      'phpunit
        'phpunit
          'phpunit (executable)
    'composer.json
    'composer.lock
    'composer.phar
'tests
  'phpunit (symlink to '../library/composer/vendor/bin/phpunit')
  'phpunit.bootstrap.php (contains bootstrap logic)
  'phpunit.xml (see below)

phpunit.xml文件包含以下内容:

<phpunit backupGlobals="true"
    backupStaticAttributes="false"
    bootstrap="phpunit.bootstrap.php"
    cacheTokens="false"
    colors="true"
    convertErrorsToExceptions="true"
    convertNoticesToExceptions="true"
    convertWarningsToExceptions="true"
    forceCoversAnnotation="false"
    mapTestClassNameToCoveredClassName="false"
    processIsolation="false"
    stopOnError="false"
    stopOnFailure="false"
    stopOnIncomplete="false"
    stopOnSkipped="false"
    strict="true"
    verbose="true">
</phpunit>
  1. 当我运行php tests/phpunit时,它显示了我的手册。
  2. 当我运行php tests/phpunit .时,它在composer/vendor文件夹中瞄准并运行测试。
  3. 当我运行php tests/phpunit unit/*它的工作,但只有unit文件夹下的内容,当然。如何使tests'phpunit直接在符号链接文件目录下运行所有测试?

尝试从编写器中删除phpunit。创建composer update文件,然后将其添加到您的编写器中。创建composer update

我在使用PHPUnit和Lumen时遇到了同样的问题,这个解决方案修复了它。

phpunit命令现在可以在根目录下工作了