Source of file TestState.php
Size: 1,066 Bytes - Last Modified: 2021-12-24T06:44:48+00:00
/var/www/docs.ssmods.com/process/src/src/TopPage/TestState.php
1234567891011121314151617181920212223242526272829303132333435363738394041 | <?php namespace DNADesign\Elemental\TopPage; use SilverStripe\Dev\SapphireTest; use SilverStripe\Dev\State\TestState as BaseState; class TestState implements BaseState { public function setUp(SapphireTest $test): void { $this->disableTopPageUpdate(); } public function tearDown(SapphireTest $test): void { } public function setUpOnce($class): void { $this->disableTopPageUpdate(); } public function tearDownOnce($class): void { } /** * We need to disable top page updates as it doesn't work with fixture builder and transactions in unit tests * caused by an attempt to traverse unsaved relations which is normally fine * the lookup failure causes the whole transaction to fail which is the whole unit test * this has no impact on the functionality, though */ private function disableTopPageUpdate(): void { /** @var DataExtension $extension */ $extension = singleton(DataExtension::class); $extension->disableTopPageUpdate(); } } |