LogicExeption when running unit tests

Silverstripe 4.4

Hi All, I get this issue when trying to run a unit test locally (it doesn’t happen on Scrutinizer):

LogicException: getItemPath returned null for SilverStripe\Dev\State\FixtureTestState. Try adding flush=1 to the test run.

/home/morven/Projects/silvercommerce-sandbox/vendor/silverstripe/framework/src/Dev/State/FixtureTestState.php:220
/home/morven/Projects/silvercommerce-sandbox/vendor/silverstripe/framework/src/Dev/State/FixtureTestState.php:195
/home/morven/Projects/silvercommerce-sandbox/vendor/silverstripe/framework/src/Dev/State/FixtureTestState.php:153
/home/morven/Projects/silvercommerce-sandbox/vendor/silverstripe/framework/src/Dev/State/FixtureTestState.php:154
/home/morven/Projects/silvercommerce-sandbox/vendor/silverstripe/framework/src/Dev/State/FixtureTestState.php:164
/home/morven/Projects/silvercommerce-sandbox/vendor/silverstripe/framework/src/Dev/State/FixtureTestState.php:66
/home/morven/Projects/silvercommerce-sandbox/vendor/silverstripe/framework/src/Dev/State/SapphireTestState.php:68
/home/morven/Projects/silvercommerce-sandbox/vendor/silverstripe/framework/src/Dev/SapphireTest.php:274

I still get it after a flush, I am guessing SilverStripe doesn’t like my fixture file? Anyone got any advise how to solve this?

Had the same problem, I deleted the cache in “silverstripe-cache” manually and the issue went away

So ran into this problem again recently. After spending an age debugging, turns out that you will get this error when generating fixtures on your unit tests if:

  1. The module you are running tests on does not have phpunit/phpunit in it’s require-dev composer dependencies.
  2. If any of the modules dev dependencies also do not require phpunit/phpunit.

By the look of it, this functionality has been marked as Depreciated, but it is currently still in effect.