dingo / api

A RESTful API package for the Laravel and Lumen frameworks.
BSD 3-Clause "New" or "Revised" License
9.33k stars 1.25k forks source link

Bug with PHPUnit coverage: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Dingo\Api\Contract\Routing\Adapter] is not instantiable while building [Dingo\Api\Routing\Router] #1791

Closed oleksandr-roskovynskyi closed 2 years ago

oleksandr-roskovynskyi commented 2 years ago
Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version 6.20.27
Package version 2.4.7
PHP version 7.4.16

Actual Behaviour

Installed successfull but after ./vendor/bin/phpunit --coverage-clover coverage.xml

I get: PHP Fatal error: Uncaught Illuminate\Contracts\Container\BindingResolutionException: Target [Dingo\Api\Contract\Routing\Adapter] is not instantiable while building [Dingo\Api\Routing\Router]. in /home/runner/work/MyService/MyService/vendor/laravel/framework/src/Illuminate/Container/Container.php:978

Expected Behaviour

Success complete tests, after ./vendor/bin/phpunit --coverage-clover coverage.xml

Steps to Reproduce

Install this package and run: ./vendor/bin/phpunit --coverage-clover coverage.xml

Possible Solutions

Please help me with the same. Thank you

oleksandr-roskovynskyi commented 2 years ago

Added to phpunit.xml

<filter>
        <whitelist processUncoveredFilesFromWhitelist="true">
            <directory suffix=".php">./app</directory>
            <directory suffix=".php">./packages/*/*/src</directory>
            <exclude>
                <file>./packages/same/api/src/routes/api.php</file>
            </exclude>
        </whitelist>
    </filter>