Project

General

Profile

Bug #23606 ยป 15802_v1.diff

Administrator Admin, 2010-09-24 22:20

View differences:

tests/t3lib/t3lib_iconWorksTest.php (Arbeitskopie)
*/
public function getSpriteIconWithEmptyStringReturnsSpanWithIconMissingSprite() {
$this->assertEquals(
'<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing"></span>',
'<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing">&nbsp;</span>',
t3lib_iconWorks::getSpriteIcon('')
);
}
......
*/
public function getSpriteIconWithMissingIconReturnsSpanWithIconMissingSprite() {
$this->assertEquals(
'<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing"></span>',
'<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing">&nbsp;</span>',
t3lib_iconWorks::getSpriteIcon('actions-juggle-speed')
);
}
......
*/
public function getSpriteIconWithExistingIconReturnsSpanWithIconSprite() {
$this->assertEquals(
'<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new"></span>',
'<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new">&nbsp;</span>',
t3lib_iconWorks::getSpriteIcon('actions-document-new')
);
}
......
*/
public function getSpriteIconWithExistingIconAndAttributeReturnsSpanWithIconSpriteAndAttribute() {
$this->assertEquals(
'<span title="foo" class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new"></span>',
'<span title="foo" class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new">&nbsp;</span>',
t3lib_iconWorks::getSpriteIcon('actions-document-new', array('title' => 'foo'))
);
}
......
*/
public function getSpriteIconWithExistingIconAndClassAttributeReturnsSpanWithIconSpriteAndClassAttribute() {
$this->assertEquals(
'<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new foo"></span>',
'<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new foo">&nbsp;</span>',
t3lib_iconWorks::getSpriteIcon('actions-document-new', array('class' => 'foo'))
);
}
......
*/
public function getSpriteIconWithExistingIconAndOverlayReturnsSpanWithIconSpriteAndOverlay() {
$result = t3lib_iconWorks::getSpriteIcon('actions-document-new', array(), array('status-overlay-hidden' => array()));
$overlay = '<span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-hidden t3-icon-overlay"></span>';
$overlay = '<span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-hidden t3-icon-overlay">&nbsp;</span>';
$this->assertEquals(
'<span class="t3-icon t3-icon-actions t3-icon-actions-document t3-icon-document-new">' . $overlay . '</span>',
$result
......
$result = t3lib_iconWorks::getSpriteIconForRecord('', array());
$this->assertEquals(
'<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing"></span>',
'<span class="t3-icon t3-icon-status t3-icon-status-status t3-icon-status-icon-missing">&nbsp;</span>',
$result
);
}
......
$result = t3lib_iconWorks::getSpriteIconForRecord('tt_content', array());
$this->assertEquals(
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text"></span>',
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text">&nbsp;</span>',
$result
);
}
......
$result = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $mockRecord);
$this->assertEquals(
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text"></span>',
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text">&nbsp;</span>',
$result
);
}
......
$result = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $mockRecord, array('class' => 'foo', 'title' => 'bar'));
$this->assertEquals(
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text foo" title="bar"></span>',
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text foo" title="bar">&nbsp;</span>',
$result
);
}
......
$result = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $mockRecord);
$this->assertEquals(
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-plugin"></span>',
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-plugin">&nbsp;</span>',
$result
);
}
......
$mockRecord = $this->mockRecord;
$mockRecord['hidden'] = '1';
$result = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $mockRecord);
$overlay = '<span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-hidden t3-icon-overlay"></span>';
$overlay = '<span class="t3-icon t3-icon-status t3-icon-status-overlay t3-icon-overlay-hidden t3-icon-overlay">&nbsp;</span>';
$this->assertEquals(
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-x t3-icon-x-content-text">' . $overlay . '</span>',
......
$result = t3lib_iconWorks::getSpriteIconForFile('');
$this->assertEquals(
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-other t3-icon-other-other"></span>',
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-other t3-icon-other-other">&nbsp;</span>',
$result
);
}
......
$result = t3lib_iconWorks::getSpriteIconForFile('foo');
$this->assertEquals(
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-other t3-icon-other-other"></span>',
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-other t3-icon-other-other">&nbsp;</span>',
$result
);
}
......
$result = t3lib_iconWorks::getSpriteIconForFile('pdf');
$this->assertEquals(
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-pdf t3-icon-pdf"></span>',
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-pdf t3-icon-pdf">&nbsp;</span>',
$result
);
}
......
$result = t3lib_iconWorks::getSpriteIconForFile('png');
$this->assertEquals(
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-media t3-icon-media-image"></span>',
'<span class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-media t3-icon-media-image">&nbsp;</span>',
$result
);
}
......
$result = t3lib_iconWorks::getSpriteIconForFile('png', array('title' => 'bar'));
$this->assertEquals(
'<span title="bar" class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-media t3-icon-media-image"></span>',
'<span title="bar" class="t3-icon t3-icon-mimetypes t3-icon-mimetypes-media t3-icon-media-image">&nbsp;</span>',
$result
);
}
    (1-1/1)