Silverstripe Version: 4.3.3
Question:
Hi, consider the following simple test class:
class MyTest extends SapphireTest
{
protected static $fixture_file = [
'app/tests/fixtures.yml'
];
public function testSomething()
{
$this->assertTrue(true); // Do whatever here, as we will never make it to this point.
}
}
If I run this test, I will get the following error message:
PHP Catchable fatal error: Argument 1 passed to SilverStripe\View\Requirements::set_backend() must be an instance of SilverStripe\View\Requirements_Backend, null given, called in /var/www/html/myproject/vendor/silverstripe/framework/src/View/Dev/RequirementsTestState.php on line 29 and defined in /var/www/html/myproject/vendor/silverstripe/framework/src/View/Requirements.php on line 116
If I remove the $fixture_file
definition, the test works without any issues. And if I set $fixture_file
to point to a non-existent file, the same error happens again, so I think that the content of the fixture file does not matter here.
This is really strange and I’ve been struggling with this for many hours now. Maybe it has something to do with my particular project (installed modules, custom code, whatever) but I really have no clue. Or then it’s a bug in SilverStripe, but then again it seems unlikely because $fixture_file
seems to be a very common feature, so probably there would already be bug reports about it if it wouldn’t work for others. I even tried to downgrade to SilverStripe 4.2.0 to check if the issue was caused by some change in the recent version history of SilverStripe, but the same problem occurred with 4.2.0 too.
Thank you for your support!