Vagrant:找不到 phpUnit(symfony 2.8)
Vagrant : phpUnit not found (symfony 2.8)
我是 phpUnit 的新手。我通过作曲家安装了它。我的 composer.json 如下:
"require": {
"php": ">=5.5.9",
"symfony/symfony": "^2.8",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"doctrine/mongodb-odm": "~1.0",
"doctrine/mongodb-odm-bundle": "~3.0",
"nicmart/tree": "~0.2",
"jms/serializer-bundle": "^1.1",
"simple-bus/symfony-bridge": "^4.1",
"phpunit/phpunit":">=4.2",
"codeception/codeception": "*",
"nicolopignatelli/valueobjects": "^4.0"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^2.7"
}
在 composer update
期间,我收到了
- 安装 phpunit/phpunit (5.2.9)
并且我在我的供应商中看到了 phpunit 目录。
现在,在简单地尝试输出 phpunit 版本时(或在尝试开始测试时),我收到以下错误消息:
me@myMachine:root/path/of/symfony$ phpunit -v
The program 'phpunit' is currently not installed. To run 'phpunit' please ask your administrator to install the package 'phpunit'
在 bash 中是否有任何类型的快捷方式可以创建?
更新
就像 2 个当前答案所建议的那样,我尝试 运行 me@myMachine:root/path/of/symfony$ ./vendor/bin/phpunit -v
但它 returns 一个 permission denied
异常,尽管当前用户 (me@myMachine) 是文件所有者。
此外,me@myMachine:root/path/of/symfony$ ls -l ./vendor/bin
returns
-rw-rw-rw- 1 me me 612 Mar 1 09:52 codecept
-rw-rw-rw- 1 me me 603 Jan 28 13:50 doctrine
-rw-rw-rw- 1 me me 609 Jan 28 13:50 doctrine-dbal
-rw-rw-rw- 1 me me 607 Jan 28 13:50 doctrine.php
-rw-rw-rw- 1 me me 608 Feb 24 19:20 geotools
-rw-rw-rw- 1 me me 603 Mar 1 09:52 phpunit
-rw-rw-rw- 1 me me 978 Jan 20 12:15 security-checker
如果尝试 chmod -vR u+x ./vendor/bin
它会 returns 正如预期的那样
mode of ‘bin/’ changed from 0777 (rwxrwxrwx) to 0766 (rwxrw-rw-)
mode of ‘bin/phpunit’ changed from 0666 (rw-rw-rw-) to 0766 (rwxrw-rw-)
但是me@myMachine:root/path/of/symfony$ ls -l ./vendor/bin
又是returns
-rw-rw-rw- 1 me me 612 Mar 1 09:52 codecept
-rw-rw-rw- 1 me me 603 Jan 28 13:50 doctrine
-rw-rw-rw- 1 me me 609 Jan 28 13:50 doctrine-dbal
-rw-rw-rw- 1 me me 607 Jan 28 13:50 doctrine.php
-rw-rw-rw- 1 me me 608 Feb 24 19:20 geotools
-rw-rw-rw- 1 me me 603 Mar 1 09:52 phpunit
-rw-rw-rw- 1 me me 978 Jan 20 12:15 security-checker
好像没有考虑到 chmod。
更新 2
看来,这个问题与Vagrant有关。
我重新安装了symfony,2.8和3.0版本,问题依旧。
我找到了 this similar issue,因此选择全局安装 phpUnit composer global require phpunit/phpunit
,然后再次 运行 phpunit -v
。这次,命令找到了,但我收到以下错误
me@myMachine:/path/to/symfony/root$ phpunit -v
PHPUnit 4.8.23 by Sebastian Bergmann and contributors.
Runtime: PHP 5.6.14-1+deb.sury.org~trusty+1
Configuration: /var/www/public/symfony/sgv3/sgv3/phpunit.xml.dist
. 1 / 1 (100%)
Time: 6.86 seconds, Memory: 27.75Mb
PHP Fatal error: Call to undefined method PHPUnit_Framework_TestResult::warningCount() in /home/vagrant/.composer/vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php on line 185
如果您通过 Composer 安装 PHPUnit,那么它的二进制文件将位于 vendor/bin/phpunit
。
您需要在您的项目的供应商的bin目录中调用特定的二进制文件
bin/phpunit -h
我是 phpUnit 的新手。我通过作曲家安装了它。我的 composer.json 如下:
"require": {
"php": ">=5.5.9",
"symfony/symfony": "^2.8",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"doctrine/mongodb-odm": "~1.0",
"doctrine/mongodb-odm-bundle": "~3.0",
"nicmart/tree": "~0.2",
"jms/serializer-bundle": "^1.1",
"simple-bus/symfony-bridge": "^4.1",
"phpunit/phpunit":">=4.2",
"codeception/codeception": "*",
"nicolopignatelli/valueobjects": "^4.0"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^2.7"
}
在 composer update
期间,我收到了
- 安装 phpunit/phpunit (5.2.9)
并且我在我的供应商中看到了 phpunit 目录。
现在,在简单地尝试输出 phpunit 版本时(或在尝试开始测试时),我收到以下错误消息:
me@myMachine:root/path/of/symfony$ phpunit -v
The program 'phpunit' is currently not installed. To run 'phpunit' please ask your administrator to install the package 'phpunit'
在 bash 中是否有任何类型的快捷方式可以创建?
更新
就像 2 个当前答案所建议的那样,我尝试 运行 me@myMachine:root/path/of/symfony$ ./vendor/bin/phpunit -v
但它 returns 一个 permission denied
异常,尽管当前用户 (me@myMachine) 是文件所有者。
此外,me@myMachine:root/path/of/symfony$ ls -l ./vendor/bin
returns
-rw-rw-rw- 1 me me 612 Mar 1 09:52 codecept
-rw-rw-rw- 1 me me 603 Jan 28 13:50 doctrine
-rw-rw-rw- 1 me me 609 Jan 28 13:50 doctrine-dbal
-rw-rw-rw- 1 me me 607 Jan 28 13:50 doctrine.php
-rw-rw-rw- 1 me me 608 Feb 24 19:20 geotools
-rw-rw-rw- 1 me me 603 Mar 1 09:52 phpunit
-rw-rw-rw- 1 me me 978 Jan 20 12:15 security-checker
如果尝试 chmod -vR u+x ./vendor/bin
它会 returns 正如预期的那样
mode of ‘bin/’ changed from 0777 (rwxrwxrwx) to 0766 (rwxrw-rw-)
mode of ‘bin/phpunit’ changed from 0666 (rw-rw-rw-) to 0766 (rwxrw-rw-)
但是me@myMachine:root/path/of/symfony$ ls -l ./vendor/bin
又是returns
-rw-rw-rw- 1 me me 612 Mar 1 09:52 codecept
-rw-rw-rw- 1 me me 603 Jan 28 13:50 doctrine
-rw-rw-rw- 1 me me 609 Jan 28 13:50 doctrine-dbal
-rw-rw-rw- 1 me me 607 Jan 28 13:50 doctrine.php
-rw-rw-rw- 1 me me 608 Feb 24 19:20 geotools
-rw-rw-rw- 1 me me 603 Mar 1 09:52 phpunit
-rw-rw-rw- 1 me me 978 Jan 20 12:15 security-checker
好像没有考虑到 chmod。
更新 2
看来,这个问题与Vagrant有关。
我重新安装了symfony,2.8和3.0版本,问题依旧。
我找到了 this similar issue,因此选择全局安装 phpUnit composer global require phpunit/phpunit
,然后再次 运行 phpunit -v
。这次,命令找到了,但我收到以下错误
me@myMachine:/path/to/symfony/root$ phpunit -v
PHPUnit 4.8.23 by Sebastian Bergmann and contributors.
Runtime: PHP 5.6.14-1+deb.sury.org~trusty+1
Configuration: /var/www/public/symfony/sgv3/sgv3/phpunit.xml.dist
. 1 / 1 (100%)
Time: 6.86 seconds, Memory: 27.75Mb
PHP Fatal error: Call to undefined method PHPUnit_Framework_TestResult::warningCount() in /home/vagrant/.composer/vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php on line 185
如果您通过 Composer 安装 PHPUnit,那么它的二进制文件将位于 vendor/bin/phpunit
。
您需要在您的项目的供应商的bin目录中调用特定的二进制文件
bin/phpunit -h