diff --git a/tests/php/Models/LinkTest.php b/tests/php/Models/LinkTest.php index 0ebfef15..9c87853c 100644 --- a/tests/php/Models/LinkTest.php +++ b/tests/php/Models/LinkTest.php @@ -20,6 +20,7 @@ use SilverStripe\LinkField\Type\Type; use SilverStripe\ORM\DataObject; use SilverStripe\ORM\ValidationException; +use SilverStripe\Versioned\Versioned; class LinkTest extends SapphireTest { @@ -36,8 +37,9 @@ protected function setUp(): void /** @var Image $image */ $image = $this->objFromFixture(Image::class, 'image-1'); - $image->setFromLocalFile(Director::baseFolder() . '/silverstripe-linkfield/tests/resources/600x400.png'); + $image->setFromLocalFile(Director::baseFolder() . '/tests/resources/600x400.png'); $image->write(); + $image->publishSingle(); } protected function tearDown(): void @@ -236,10 +238,14 @@ public function linkTypeEnabledProvider(): array */ public function testGetUrl(string $identifier, string $class, string $expected): void { - /** @var Link $link */ - $link = $this->objFromFixture($class, $identifier); + Versioned::withVersionedMode(function () use ($identifier, $class, $expected): void { + Versioned::set_stage(Versioned::LIVE); - $this->assertSame($expected, $link->getURL(), 'We expect specific URL value'); + /** @var Link $link */ + $link = $this->objFromFixture($class, $identifier); + + $this->assertSame($expected, $link->getURL(), 'We expect specific URL value'); + }); } public function linkUrlCasesDataProvider(): array