Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorHugues Peccatte <hugues.peccatte@gmail.com>2019-11-03 22:13:31 +0300
committerHugues Peccatte <hugues.peccatte@gmail.com>2019-11-03 22:51:54 +0300
commit164c15854d02359db008a24a6c74a64f376956dc (patch)
tree2dba29c8bb58535449d88e01bea04636280fb7d6 /test
parente4dd3f08ceff880abff07902b580d6ad8772bc82 (diff)
Add unit tests for Util::isInteger
Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
Diffstat (limited to 'test')
-rw-r--r--test/classes/UtilTest.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php
index 8b4ed63e7e..047f2b1753 100644
--- a/test/classes/UtilTest.php
+++ b/test/classes/UtilTest.php
@@ -2128,4 +2128,51 @@ class UtilTest extends PmaTestCase
],
];
}
+
+ /**
+ * Test for Util::isInteger
+ *
+ * @param bool $expected Expected result for a given input
+ * @param mixed $input Input data to check
+ *
+ * @return void
+ *
+ * @dataProvider providerIsInteger
+ */
+ public function testIsInteger($expected, $input)
+ {
+ $isInteger = Util::isInteger($input);
+ $this->assertEquals($expected, $isInteger);
+ }
+
+ /**
+ * Data provider for Util::isInteger test
+ *
+ * @return array
+ */
+ public function providerIsInteger()
+ {
+ return [
+ [
+ true,
+ 1000,
+ ],
+ [
+ true,
+ '1000',
+ ],
+ [
+ false,
+ 1000.1,
+ ],
+ [
+ false,
+ '1000.1',
+ ],
+ [
+ false,
+ 'input',
+ ],
+ ];
+ }
}