summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-12 14:44:28 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-12 14:44:28 -0400
commite515f37435db6cf883215f13f02391d8b2107d47 (patch)
tree3df01bc0c420a2c497302c5a38aa9d724b2e764c /tests/units
parente57386a18393e85f073cccff70699ad9afc19119 (diff)
Add user CSV import
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/Core/CsvTest.php22
-rw-r--r--tests/units/Core/RouterTest.php6
-rw-r--r--tests/units/Model/AclTest.php3
3 files changed, 29 insertions, 2 deletions
diff --git a/tests/units/Core/CsvTest.php b/tests/units/Core/CsvTest.php
new file mode 100644
index 00000000..1534584e
--- /dev/null
+++ b/tests/units/Core/CsvTest.php
@@ -0,0 +1,22 @@
+<?php
+
+require_once __DIR__.'/../Base.php';
+
+use Core\Csv;
+
+class CsvTest extends Base
+{
+ public function testGetBooleanValue()
+ {
+ $this->assertEquals(1, Csv::getBooleanValue('1'));
+ $this->assertEquals(1, Csv::getBooleanValue('True'));
+ $this->assertEquals(1, Csv::getBooleanValue('t'));
+ $this->assertEquals(1, Csv::getBooleanValue('TRUE'));
+ $this->assertEquals(1, Csv::getBooleanValue('true'));
+ $this->assertEquals(1, Csv::getBooleanValue('T'));
+
+ $this->assertEquals(0, Csv::getBooleanValue('0'));
+ $this->assertEquals(0, Csv::getBooleanValue('123'));
+ $this->assertEquals(0, Csv::getBooleanValue('anything'));
+ }
+}
diff --git a/tests/units/Core/RouterTest.php b/tests/units/Core/RouterTest.php
index 99c49ba8..56a87662 100644
--- a/tests/units/Core/RouterTest.php
+++ b/tests/units/Core/RouterTest.php
@@ -10,11 +10,13 @@ class RouterTest extends Base
{
$r = new Router($this->container);
- $this->assertEquals('plop', $r->sanitize('PloP', 'default'));
+ $this->assertEquals('PloP', $r->sanitize('PloP', 'default'));
$this->assertEquals('default', $r->sanitize('', 'default'));
$this->assertEquals('default', $r->sanitize('123-AB', 'default'));
$this->assertEquals('default', $r->sanitize('R&D', 'default'));
- $this->assertEquals('default', $r->sanitize('Test123', 'default'));
+ $this->assertEquals('Test123', $r->sanitize('Test123', 'default'));
+ $this->assertEquals('Test_123', $r->sanitize('Test_123', 'default'));
+ $this->assertEquals('userImport', $r->sanitize('userImport', 'default'));
}
public function testPath()
diff --git a/tests/units/Model/AclTest.php b/tests/units/Model/AclTest.php
index 3cb28a77..205e7ee3 100644
--- a/tests/units/Model/AclTest.php
+++ b/tests/units/Model/AclTest.php
@@ -17,6 +17,7 @@ class AclTest extends Base
'controller3' => '*',
'controller5' => '-',
'controller6' => array(),
+ 'controllera' => '*',
);
$acl = new Acl($this->container);
@@ -30,6 +31,8 @@ class AclTest extends Base
$this->assertFalse($acl->matchAcl($acl_rules, 'controller4', 'anything'));
$this->assertFalse($acl->matchAcl($acl_rules, 'controller5', 'anything'));
$this->assertFalse($acl->matchAcl($acl_rules, 'controller6', 'anything'));
+ $this->assertTrue($acl->matchAcl($acl_rules, 'ControllerA', 'anything'));
+ $this->assertTrue($acl->matchAcl($acl_rules, 'controllera', 'anything'));
}
public function testPublicActions()