summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-06-28 17:17:24 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-06-29 00:12:22 +0200
commit5d0aaf958325f500ce69cfb79e69eb0d8f83fdeb (patch)
tree96236bc76befde8b5eefe62c2c3ac5cb87141cc4 /_test
parent0189bd8669742c5290a4f6538f954b81554e26d2 (diff)
downloadrpg-5d0aaf958325f500ce69cfb79e69eb0d8f83fdeb.tar.gz
rpg-5d0aaf958325f500ce69cfb79e69eb0d8f83fdeb.tar.bz2
treat empty string inputs as unset for int and bool
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/input.test.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/_test/tests/inc/input.test.php b/_test/tests/inc/input.test.php
index 627af3a2b..761b7ddbc 100644
--- a/_test/tests/inc/input.test.php
+++ b/_test/tests/inc/input.test.php
@@ -95,6 +95,11 @@ class input_test extends DokuWikiTest {
$this->assertSame(1, $INPUT->get->int('get', false));
$this->assertSame(0, $INPUT->int('array'));
+
+ $this->assertSame(0, $INPUT->int('zero', -1));
+ $this->assertSame(-1, $INPUT->int('empty', -1));
+ $this->assertSame(-1, $INPUT->int('zero', -1, true));
+ $this->assertSame(-1, $INPUT->int('empty', -1, true));
}
public function test_arr() {
@@ -155,6 +160,11 @@ class input_test extends DokuWikiTest {
$this->assertSame(false, $INPUT->post->bool('get'));
$this->assertSame(true, $INPUT->post->bool('post'));
+
+ $this->assertSame(false, $INPUT->bool('zero', -1));
+ $this->assertSame(-1, $INPUT->bool('empty', -1));
+ $this->assertSame(-1, $INPUT->bool('zero', -1, true));
+ $this->assertSame(-1, $INPUT->bool('empty', -1, true));
}
public function test_remove() {
@@ -203,4 +213,4 @@ class input_test extends DokuWikiTest {
$this->assertEquals('bla',$test);
}
-} \ No newline at end of file
+}