symfony: ./bin/phpunit command not found

Symfony version(s) affected: 4.0

Description
https://symfony.com/doc/current/testing.html

Just following the tutorial and there is no phpunit file located in my bin directory.

This is my ouput from my terminal when running this composer require --dev symfony/phpunit-bridge

./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) ^[[DNothing to install or update Generating autoload files ocramius/package-versions: Generating version class… ocramius/package-versions: …done generating version class Executing script cache:clear [OK] Executing script assets:install --symlink --relative public [OK]

How to reproduce

composer require --dev symfony/phpunit-bridge ./bin/phpunit

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

@rottenoats In this case, updating to the latest version of Symfony Flex and running composer fix-recipes afterwards may also help. It will apply all recipes that haven’t been applied yet. But I suggest to carefully review the result changes afterwards.

That’s because Flex is a Composer plugin only intervening on initial install, as you’re actually free to modify/delete anything it adds to your project.

Remove the package and re-add it to let Flex do its job:

composer rem --dev symfony/phpunit-bridge
composer req --dev symfony/phpunit-bridge

The guide assumes you have Symfony Flex installed, which it is if you started development from one of the skeletons (ie. composer create symfony/skeleton). You should composer req symfony/flex in your project if using 4.0+.

Guide should mention this though, Symfony without Flex is still a supported scenario.

I feel good to know that I saved you all the hair pulling 😛

In the meantime, I resolved the issue I had, it was due to the project existing for quite sometime, and bin/phpunit was in the gitignore (not explicitly but all bin except console were ignore) , commiting bin/phpunit solved the issue

I’m having the same issue in symfony 4.4, and googling only refer this issue so I post here, on a fresh install of my project, the bin/phpunit is not installed (though I do have symfony/flex ) , running composer fix-recipes seems to fix the issue once, however now in CI it does not work (it tells me there’s no recipes to install )

I’ve installed on Flex enabled app (with many flex recipes working OK), by:

composer require --dev phpunit

bin/phpunit Does exists. However it’s composer in disguise. It tryies to find composer.json in bin/ (???), and procedes to run composer install still in bin/

Second run will run phpunit.

Update: composer remove --dev phpunit do not clears that ‘bin/.phpunit’ vendor folder

Is this proper venue for this issue?