You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In SapphireTest::start() there is a call to $controller->doInit();, however this causes issues if there are any DB calls in a custom init() method or if using the onBeforeInit hook as the DB is not ready at the point this is called.
Steps to Reproduce
Create a unit test for a class that is using the onBeforeInit hook and make a DB call in that method, e.g.
<?php
class TestMe extends DataExtension
{
public function onBeforeInit()
{
// this will cause the unit test to fail as DB is not setup yet
$pages = Page::get();
}
}
The text was updated successfully, but these errors were encountered:
This can happen outside of testing as well, for example I added some code to Controller::onBeforeInit() that gets from values from SiteConfig and it causes a Table not found error when the site first builds.
Affected Version
SS4.x
Description
In
SapphireTest::start()
there is a call to$controller->doInit();
, however this causes issues if there are any DB calls in a custominit()
method or if using theonBeforeInit
hook as the DB is not ready at the point this is called.Steps to Reproduce
Create a unit test for a class that is using the
onBeforeInit
hook and make a DB call in that method, e.g.The text was updated successfully, but these errors were encountered: