Skip to content

Commit cfe254b

Browse files
authored
Merge pull request #156 from hydephp/147-add-test-for-packagesframeworksrccommandshydepackagediscovercommandphp
Add tests for Image::getLink()
2 parents e4d5629 + 3351353 commit cfe254b

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

packages/framework/tests/Feature/ImageModelTest.php

+27
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,31 @@ public function test_get_metadata_array()
143143
'contentUrl' => null,
144144
], $image->getMetadataArray());
145145
}
146+
147+
public function test_get_link_resolves_remote_paths()
148+
{
149+
$image = new Image([
150+
'uri' => 'https://example.com/image.jpg',
151+
]);
152+
153+
$this->assertEquals('https://example.com/image.jpg', $image->getLink());
154+
}
155+
156+
public function test_get_link_resolves_local_paths()
157+
{
158+
$image = new Image([
159+
'path' => 'image.jpg',
160+
]);
161+
162+
$this->assertEquals('media/image.jpg', $image->getLink());
163+
}
164+
165+
public function test_get_link_resolves_local_paths_when_on_nested_page()
166+
{
167+
$image = new Image([
168+
'path' => 'image.jpg',
169+
]);
170+
171+
$this->assertEquals('../media/image.jpg', $image->getLink('foo/bar'));
172+
}
146173
}

0 commit comments

Comments
 (0)