Permalink
Browse files

MINOR Added FileTest->testValidateExtension() (related to #5693) (fro…

…m r106805)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112539 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information...
1 parent 122549c commit dcb402479a062b29d6a17932bf214fe22388aac9 @chillu chillu committed Oct 15, 2010
Showing with 15 additions and 0 deletions.
  1. +15 −0 tests/filesystem/FileTest.php
@@ -6,6 +6,21 @@
class FileTest extends SapphireTest {
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() {
$file = $this->objFromFixture('File', 'asdf');
$this->assertEquals(ASSETS_DIR . '/asdfjkl.txt', $file->RelativeLink());

0 comments on commit dcb4024

Please sign in to comment.