summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-05-23 21:45:39 -0400
committerFrederic Guillot <fred@kanboard.net>2015-05-23 21:45:39 -0400
commit6bee8822bc7622a8b2147172c86554cc3c021188 (patch)
tree35ea85f60b8e0f848505d710e8ca36a1f5316574 /tests/units
parente32f26d048249b84166542d6442efdf202ff44fd (diff)
parent8e3618f4128e419e1522e48ccec27082d30e4de4 (diff)
Merge branch 'master' of https://github.com/fguillot/kanboard
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/FileTest.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/units/FileTest.php b/tests/units/FileTest.php
new file mode 100644
index 00000000..5e882fdb
--- /dev/null
+++ b/tests/units/FileTest.php
@@ -0,0 +1,31 @@
+<?php
+
+require_once __DIR__.'/Base.php';
+
+use Model\Task;
+use Model\File;
+use Model\TaskCreation;
+use Model\Project;
+
+class FileTest extends Base
+{
+ public function testCreationFileNameTooLong()
+ {
+ $p = new Project($this->container);
+ $f = new File($this->container);
+ $tc = new TaskCreation($this->container);
+
+ $this->assertEquals(1, $p->create(array('name' => 'test')));
+ $this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'test')));
+
+ $this->assertTrue($f->create(1, 'test', '/tmp/foo', false, 10));
+ $this->assertTrue($f->create(1, str_repeat('a', 1000), '/tmp/foo', false, 10));
+
+ $files = $f->getAll(1);
+ $this->assertNotEmpty($files);
+ $this->assertCount(2, $files);
+
+ $this->assertEquals(str_repeat('a', 255), $files[0]['name']);
+ $this->assertEquals('test', $files[1]['name']);
+ }
+}