silverstripe-framework/tests/model/ImageTest.php
Saophalkun Ponlu ce6402f8d0 ENHANCEMENT: use image file name (without file path and extension) for alt attribute when title is not provided
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@77668 467b73ca-7a2a-4603-9d3b-597d59a354a9
2009-05-24 12:16:17 +00:00

29 lines
1.1 KiB
PHP

<?php
class ImageTest extends SapphireTest {
static $fixture_file = 'sapphire/tests/model/ImageTest.yml';
function testGetTagWithTitle() {
$image = $this->fixture->objFromFixture('Image', 'imageWithTitle');
$expected = '<img src="' . Director::baseUrl() . 'sapphire/tests/model/testimages/test_image.png" alt="This is a image Title" />';
$actual = $image->getTag();
$this->assertEquals($expected, $actual);
}
function testGetTagWithoutTitle() {
$image = $this->fixture->objFromFixture('Image', 'imageWithoutTitle');
$expected = '<img src="' . Director::baseUrl() . 'sapphire/tests/model/testimages/test_image.png" alt="test_image" />';
$actual = $image->getTag();
$this->assertEquals($expected, $actual);
}
function testGetTagWithoutTitleContainingDots() {
$image = $this->fixture->objFromFixture('Image', 'imageWithoutTitleContainingDots');
$expected = '<img src="' . Director::baseUrl() . 'sapphire/tests/model/testimages/test.image.with.dots.png" alt="test.image.with.dots" />';
$actual = $image->getTag();
$this->assertEquals($expected, $actual);
}
}
?>