我正在运行基于Symfony 2.8的Web应用程序。现在我尝试按照docs添加PHPUnit支持到项目:
$ composer require --dev symfony/phpunit-bridge
虽然这会将symfony/phpunit-bridge
要求添加到packages-dev
文件的composer.json
,但实际上并未安装文件。
手动运行update
也不会改变:
composer update --dev symfony/phpunit-bridge
You are using the deprecated option "dev". Dev packages are installed by default now.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
因此,我在尝试运行测试时遇到错误
./vendor/bin/simple-phpunit -c app src/AppBundle/
-bash: ./vendor/bin/simple-phpunit: No such file or directory
bin
中没有/vendor
个子网址。
我做错了什么?
修改
$ composer show symfony/phpunit-bridge
name : symfony/phpunit-bridge
descrip. : Symfony PHPUnit Bridge
keywords :
versions : * v4.1.0
type : symfony-bridge
license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
source : [git] https://github.com/symfony/phpunit-bridge.git b3451fc442baaf9169e50491a059ef17582c4424
dist : [zip] https://api.github.com/repos/symfony/phpunit-bridge/zipball/b3451fc442baaf9169e50491a059ef17582c4424 b3451fc442baaf9169e50491a059ef17582c4424
names : symfony/phpunit-bridge
autoload
files
psr-4
Symfony\Bridge\PhpUnit\ => .
exclude-from-classmap
requires
php >=5.3.3
suggests
ext-zip Zip support is required when using bin/simple-phpunit
symfony/debug For tracking deprecated interfaces usages at runtime with DebugClassLoader
conflicts
phpunit/phpunit <4.8.35|<5.4.3,>=5.0
答案 0 :(得分:0)
删除from unittest.mock import patch, call
@patch('builtins.print')
def test_print(mocked_print):
print('foo')
print()
assert mocked_print.mock_calls == [call('foo'), call()]
目录并重新运行vendor
后,我发现了以下消息:
composer install
从Skipped installation of bin bin/simple-phpunit for package symfony/phpunit-bridge: name conflicts with an existing file
composer.json
如果没有这些行,则会正确创建"config" : {
"bin-dir" : "bin"
},
文件夹和包含文件。