From ddd88cdd2debd67560398eb86ea0e43901939c4e Mon Sep 17 00:00:00 2001 From: Christopher Smith <chris@jalakai.co.uk> Date: Fri, 25 Sep 2015 16:58:26 +0100 Subject: [PATCH] improve blank() unit tests --- _test/tests/inc/common_blank.test.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/_test/tests/inc/common_blank.test.php b/_test/tests/inc/common_blank.test.php index e6d39a479..9df35936a 100644 --- a/_test/tests/inc/common_blank.test.php +++ b/_test/tests/inc/common_blank.test.php @@ -36,15 +36,17 @@ class common_blank_test extends DokuWikiTest { } function test_trim() { - $blank = " "; - $this->assertFalse(blank($blank)); - $this->assertTrue(blank($blank, true)); + $whitespace = " \t\r\n"; + $this->assertFalse(blank($whitespace), "using default \$trim value"); + $this->assertFalse(blank($whitespace, false), "using \$trim = false"); + $this->assertTrue(blank($whitespace, true), "using \$trim = true"); } - function test_undefindex() { + function test_undefined() { $undef = array(); - $this->assertTrue(blank($undef['nope'])); - $this->assertTrue(blank($this->nope)); + $this->assertTrue(blank($var), "using undefined/unitialised variable"); + $this->assertTrue(blank($undef['nope']), "using undefined array index"); + $this->assertTrue(blank($this->nope), "using unset object property"); } } -- GitLab