Fixed SessionGridFieldStateManager unit test to work regardless of

current gridfield state manager configuration.
This commit is contained in:
Niklas Forsdahl 2024-06-20 14:58:55 +03:00
parent d448708fb3
commit e9cd597a22

View File

@ -5,15 +5,24 @@ namespace SilverStripe\Forms\Tests\GridField;
use SilverStripe\Control\Controller;
use SilverStripe\Control\HTTPRequest;
use SilverStripe\Control\Session;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\Form;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldStateManagerInterface;
use SilverStripe\Forms\GridField\SessionGridFieldStateManager;
use SilverStripe\Forms\Tests\GridField\GridFieldPrintButtonTest\TestObject;
class SessionGridFieldStateManagerTest extends SapphireTest
{
protected function setUp(): void
{
parent::setUp();
// configure the injector to use the session grid field state manager
Injector::inst()->registerService(new SessionGridFieldStateManager(), GridFieldStateManagerInterface::class);
}
public function testStateKey()
{
$manager = new SessionGridFieldStateManager();