mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Added FileTest->testValidateExtension() (related to #5693)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@106805 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
aefecf2965
commit
42ee289493
@ -6,6 +6,21 @@
|
|||||||
class FileTest extends SapphireTest {
|
class FileTest extends SapphireTest {
|
||||||
static $fixture_file = 'sapphire/tests/filesystem/FileTest.yml';
|
static $fixture_file = 'sapphire/tests/filesystem/FileTest.yml';
|
||||||
|
|
||||||
|
function testValidateExtension() {
|
||||||
|
$file = $this->objFromFixture('File', 'asdf');
|
||||||
|
|
||||||
|
// Invalid
|
||||||
|
$file->Name = 'asdf.php';
|
||||||
|
$v = $file->validate();
|
||||||
|
$this->assertFalse($v->valid());
|
||||||
|
$this->assertContains('Extension is not allowed', $v->message());
|
||||||
|
|
||||||
|
// Valid
|
||||||
|
$file->Name = 'asdf.txt';
|
||||||
|
$v = $file->validate();
|
||||||
|
$this->assertTrue($v->valid());
|
||||||
|
}
|
||||||
|
|
||||||
function testLinkAndRelativeLink() {
|
function testLinkAndRelativeLink() {
|
||||||
$file = $this->objFromFixture('File', 'asdf');
|
$file = $this->objFromFixture('File', 'asdf');
|
||||||
$this->assertEquals(ASSETS_DIR . '/asdfjkl.txt', $file->RelativeLink());
|
$this->assertEquals(ASSETS_DIR . '/asdfjkl.txt', $file->RelativeLink());
|
||||||
|
Loading…
Reference in New Issue
Block a user