mardi 25 février 2020

Phpspec global composer install not working

I have installed phpspec through composer within codebase root by doing composer require phpspec/phpspec. I wanted to run it without prefixing it each time with vendor/bin, but I also didn't want to add that to PATH, so I installed it globally first with composer global require phpspec/phpspec (both versions are the same) and added to path with export PATH=$PATH:~/.composer/vendor/bin (I am on MacOS Catalina).

Now I can run phpspec from the codebase root, and it does indeed run. I can run phpspec describe xxx which does create a file and works, however doing a phpspec run fails miserably:

✘ Fatal error happened while executing the following

    Uncaught TypeError: Argument 2 passed to Symfony\Component\EventDispatcher\EventDispatcher::dispatch() must be an instance of Symfony\Component\EventDispatcher\Event or null, string given, called in /Users/.../.composer/vendor/phpspec/phpspec/src/PhpSpec/Util/DispatchTrait.php on line 22 and defined in /Users/.../.composer/vendor/symfony/event-dispatcher/EventDispatcher.php:37
Stack trace:
#0 /Users/.../.composer/vendor/phpspec/phpspec/src/PhpSpec/Util/DispatchTrait.php(22): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(PhpSpec\Event\SuiteEvent), 'beforeSuite')
#1 /Users/.../.composer/vendor/phpspec/phpspec/src/PhpSpec/Runner/SuiteRunner.php(52): PhpSpec\Runner\SuiteRunner->dispatch(Object(Symfony\Component\EventDispatcher\EventDispatcher), Object(PhpSpec\Event\SuiteEvent), 'beforeSuite')
#2 /Users/.../.composer/vendor/phpspec/phpspec/src/PhpSpec/Console/Command/RunCommand.php(178): PhpSpec\Runner\SuiteRunner->run(Object(PhpSpec\Loader\Suite))
#3 /Users/.../.composer/ven in /Users/.../.composer/vendor/symfony/event-dispatcher/EventDispatcher.php on line 37

However running vendor/bin/phpspec run goes through fine.

What might be the error here?

Aucun commentaire:

Enregistrer un commentaire