From e515f37435db6cf883215f13f02391d8b2107d47 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 12 Oct 2015 14:44:28 -0400 Subject: Add user CSV import --- tests/units/Core/CsvTest.php | 22 ++++++++++++++++++++++ tests/units/Core/RouterTest.php | 6 ++++-- tests/units/Model/AclTest.php | 3 +++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/units/Core/CsvTest.php (limited to 'tests/units') 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 @@ +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() -- cgit v1.2.3