Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NunoMaduro\Collision\Adapters\Phpunit\Printer construct error #240

Closed
mbaric opened this issue Dec 5, 2022 · 3 comments
Closed

NunoMaduro\Collision\Adapters\Phpunit\Printer construct error #240

mbaric opened this issue Dec 5, 2022 · 3 comments

Comments

@mbaric
Copy link

mbaric commented Dec 5, 2022

Php is dockerized in it's container:

PHP 8.1.1 (cli) (built: Dec 18 2021 01:38:53) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.1, Copyright (c) Zend Technologies
    with Xdebug v3.1.1, Copyright (c) 2002-2021, by Derick Rethans

Laravel Framework 8.83.26

Phpunit:

composer info phpunit/phpunit
name     : phpunit/phpunit
descrip. : The PHP Unit Testing framework.
keywords : phpunit, testing, xunit
versions : * 9.5.26
type     : library
license  : BSD 3-Clause "New" or "Revised" License (BSD-3-Clause) (OSI approved) https://spdx.org/licenses/BSD-3-Clause.html#licenseText
homepage : https://phpunit.de/
source   : [git] https://github.com/sebastianbergmann/phpunit.git 851867efcbb6a1b992ec515c71cdcf20d895e9d2
dist     : [zip] https://api.github.com/repos/sebastianbergmann/phpunit/zipball/851867efcbb6a1b992ec515c71cdcf20d895e9d2 851867efcbb6a1b992ec515c71cdcf20d895e9d2
path     : /app/vendor/phpunit/phpunit
names    : phpunit/phpunit

When running:

$ docker-compose exec php_fpm bash
$ php artisan test

NunoMaduro\Collision\Adapters\Phpunit\Printer::__construct(): Argument #1 ($output) must be of type ?Symfony\Component\Console\Output\ConsoleOutputInterface, string given, called in /app/vendor/phpunit/phpunit/src/TextUI/TestRunner.php on line 1230

I traced it a bit a fallen back to:

vendor/phpunit/phpunit/src/TextUI/TestRunner.php:1223

 private function createPrinter(string $class, array $arguments): ResultPrinter
    {
        $object = new $class(
            (isset($arguments['stderr']) && $arguments['stderr'] === true) ? 'php://stderr' : null,
            $arguments['verbose'],
            $arguments['colors'],
            $arguments['debug'],
            $arguments['columns'],
            $arguments['reverseList']
        );

        assert($object instanceof ResultPrinter);

        return $object;
    }

Let me know if you need more details.

FYI if I set that part (isset($arguments['stderr']) && $arguments['stderr'] === true) ? 'php://stderr' : null, to null only it works further.

@hendrik185
Copy link

I'm still searching for a fix, I've created a stackoverflow post : stackoverflow

@bryannielsen
Copy link

I just hit this issue in a project with slightly different versions:

  • Laravel: 8.83.27
  • PHP: 8.0.28
  • PHPUnit: 9.6.3
  • Collision: v5.11.0

Everything was working correctly a few days ago but I can't isolate what changed. I had to reinstall valet and some global composer dependencies but I don't see how that would affect this project. I'm able to run the tests without a problem if I use ./vendor/bin/phpunit instead of php artisan test

@nunomaduro
Copy link
Owner

Only Collision 6 (with PHPUnit 9) and 7 (with PHPUnit 10) are supported at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants