phpunit看错文件夹或失败,说没有安装composer

I am trying to run phpunit through a symlink on Mac (10.10.5).

Composer is self-updated (c85894e7920c5e83d93d88b541bc4ebf) and phpunit is version "4.4.5".

I have the following file structure (simplified):

\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)

The phpunit.xml file has the following contents:

<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. When I run php tests/phpunit, it presents me with the manual.
  2. When I run php tests/phpunit ., it targets and runs tests in the composer/vendor folders.
  3. When I run php tests/phpunit unit/* it works, but only for the contents below the unit folder, of course. How can I make tests\phpunit run all tests directly at and below the symlink files directory?

Try ro remove phpunit from your composer.json file and make composer update and than add it to your composer.json file again and make composer update

I had faced with same problem using PHPUnit with Lumen and this solution fixed it.

phpunit command works on root folder now.