Closed TbishopP closed 1 year ago
Hello there! Thanks for opening your first issue on this repo!
Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.
Backpack communication channels:
backpack-for-laravel
tag;Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.
Thank you!
-- Justin Case The Backpack Robot
That issue also occurs with PHPUnit on the following setup:
### PHP VERSION:
PHP 8.1.11 (cli) (built: Sep 28 2022 11:08:17) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.1.11, Copyright (c) Zend Technologies
with the ionCube PHP Loader v12.0.2, Copyright (c) 2002-2022, by ionCube Ltd.
### LARAVEL VERSION:
v9.46.0@62b05b6de5733d89378a279e40230a71e5ab5d92
### BACKPACK VERSION:
5.4.13@af521f3bfed6de5c41811289d901c6c66f8242e2
Edit: Here is the full error message from the screenshot above (to be searchable):
Illuminate\Contracts\Container\BindingResolutionException : Target class Backpack\CRUD\Tests\Unit\Http\Controllers\UserCrudController] does not exist.
@pxpm @tabacitu
The file testing.php
was introduced round about one month ago:
https://github.com/Laravel-Backpack/CRUD/blob/main/src/routes/backpack/testing.php
This file wants to load the class Backpack\CRUD\Tests\Unit\Http\Controllers\UserCrudController
, what it causing the issue. The class is requested for autoloading via the following definition in the composer.json file:
"autoload-dev": {
"psr-4": {
"Backpack\\CRUD\\Tests\\": "tests",
"Backpack\\CRUD\\Tests81\\": "tests81"
},
[...]
},
The problem is, that autoload-dev is only loaded, when the package that defines that autoload is the root package. (see documentation of composer here)
Because the file is loaded also when backpack is not the root package (when the class is not autoloaded), this crashes all tests for all projects, when backpack is installed.
Workaround: As this was introduced in 5.4.12, downgrading to 5.4.11 fixes this issue and my tests are working again for now.
Attention: That is not a fix as downgrading is never recommended. This is only a workaround until a fixed version is provided!
We can replicate this on our side too. Perfect diagnosis @BernhardK91 and looking at the Class Map generated by the composer autoloader this is absolutely the case.
For now we have pinned the version to 5.4.11.
Hey guys.
Sorry for the bad experience! I am on it, we should be good at most by tomorrow!!
: 🙏
I am experimenting the same issue. My package's TestCase loads BackpackServiceProvider and all my tests are failing, looking for UserCrudController
Pedro fixed it in https://github.com/Laravel-Backpack/CRUD/pull/4881 - so no need to lock it to 5.4.11
any more, a composer update
should fix it for you.
Thanks for letting us know guys 🤦♂️ This is one of those times.
Cheers!
Thank you all for the contribution.
I created the file to clean up our test setup a little bit, and it had unintended consequences. I am the one to blame here 😞
I reverted the url generation to our test setup in https://github.com/Laravel-Backpack/CRUD/pull/4881 that @tabacitu already merged and tagged.
So a composer update backpack/crud
should get everything working back for you guys!
Sorry again for the bad experience 🙏
@pxpm Nobody should be blamed for anything! There is no improvement without the risk of errors. And errors happen.
Thank you very much for your afford and the fast fix!
Appreciate the quick resolution all, and no need to apologise! 🙏🏼
Bug report
What I did
Ran vendor/bin/pest --coverage --parallel
What I expected to happen
My tests to execute
What happened
The following errors are displayed and tests do not run
What I've already tried to fix it
Rolling back to 5.4.11 has allowed me to run the tests in the meantime, i'm yet to try and investigate a further fix
Is it a bug in the latest version of Backpack?
Bug present in 5.4.12 and up
Backpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is:PHP VERSION:
PHP 8.1.6 (cli) (built: May 12 2022 23:30:39) (NTS) Copyright (c) The PHP Group Zend Engine v4.1.6, Copyright (c) Zend Technologies with Xdebug v3.1.4, Copyright (c) 2002-2022, by Derick Rethans with Zend OPcache v8.1.8, Copyright (c), by Zend Technologies
LARAVEL VERSION:
v9.46.0@62b05b6de5733d89378a279e40230a71e5ab5d92
BACKPACK VERSION:
5.4.13@af521f3bfed6de5c41811289d901c6c66f8242e2