winter icon indicating copy to clipboard operation
winter copied to clipboard

Fix Exception class not found on database.tester plugin refresh

Open RomainMazB opened this issue 2 years ago • 0 comments

I tried to run some databases tests using the PluginTestCase but for some reason I'm trying to figure out, the Database.Tester is not found on my system (but that's another problem).

This ended to this error:

System\Tests\Plugins\Database\NestedTreeModelTest::testGetNested
Error: Class "System\Tests\Bootstrap\Exception" not found

/home/vagrant/code/modules/system/tests/bootstrap/PluginTestCase.php:152
/home/vagrant/code/modules/system/tests/plugins/database/NestedTreeModelTest.php:17

I fixed it using the general codestyle: importing the Exception class with an use statement and removing the backslash when present.

To be crystal clear, the error was thrown by this line which didn't use the backslash:

https://github.com/wintercms/winter/blob/7fe167c41fc2007e44201dff60136bdd083bf2b4/modules/system/tests/bootstrap/PluginTestCase.php#L148-L153

[EDIT] To see the error by yourself (now that I know why the Database.Tester plugin was not found on my machine), just rollback this changes: https://github.com/wintercms/winter/commit/7fe167c41fc2007e44201dff60136bdd083bf2b4#diff-7382f8d196c94d9c7562f9c1d5d9780aedf59889b83b0c0e950dee45b01e777dL99
this will make the PluginTestCase to not found the plugin,
and run any test that rely on the PluginTestCase class:

php artisan winter:test -m system -- --filter NestedTreeModelTest

RomainMazB avatar Aug 17 '22 11:08 RomainMazB