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

[9.x] Target [Illuminate\Contracts\Broadcasting\Factory] is not instantiable while testing If any report is configured. #210

Closed
fcno opened this issue Jan 30, 2022 · 2 comments

Comments

@fcno
Copy link

fcno commented Jan 30, 2022

  • Laravel Version: 9.x

  • PHP Version: PHP 8.1.1 (cli) (built: Dec 15 2021 10:31:43) (ZTS Visual C++ 2019 x64)
    Zend Engine v4.1.1, Copyright (c) Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans

  • Collision: ^6.0

Note: I opened this issue in Laravel Framework #40714, but they told me to open it here.

Description:

At the end of the tests execution, If file phpunit.xml is configured to generate a report, the following error is being thrown, causing the suite to fail, even though all tests have passed.

Target [Illuminate\Contracts\Broadcasting\Factory] is not instantiable

This behavior does not occur in Laravel 8.x, only in 9.x.

Command & output

$ php artisan test

   PASS  Tests\Unit\ExampleTest
  ✓ that true is true

   PASS  Tests\Feature\ExampleTest
  ✓ the application returns a successful response

  Tests:  2 passed
  Time:   0.40s

Target [Illuminate\Contracts\Broadcasting\Factory] is not instantiable.

Steps To Reproduce:

  1. Create a fresh Laravel 9.x application
  2. Add the following configuration in phpunit.xml file (the report part).
  <coverage processUncoveredFiles="true">
      [...]
      <report>
          <html outputDirectory="build/coverage"/>
      </report>
  <coverage processUncoveredFiles="true">
  1. Do not change anything else in the application, use everything with default values generated by Laravel.
  2. Execute php artisan test

If you follow the steps above, in Laravel 8 there won't be the error, but in Laravel 9 there will be.

@jnoordsij
Copy link
Contributor

I'm having the exact same error with the following phpunit.xml report entry:

<coverage cacheDirectory="./.phpunit" processUncoveredFiles="true">
    <report>
        <text outputFile="php://output"/>
    </report>
    <include>
        <directory suffix=".php">./app</directory>
        <directory suffix=".php">./routes</directory>
    </include>
</coverage>

Any idea on when to expect a fix for this? Seems pretty relevant with the Laravel 9 release coming up 😅

@nunomaduro
Copy link
Owner

laravel/laravel#5800

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

3 participants