Skip to content

Commit

Permalink
Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mfendeksilverstripe committed Jul 28, 2023
1 parent 5d80027 commit ee16e1e
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tests/php/Models/LinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ee16e1e

Please sign in to comment.