diff options
author | William Desportes <williamdes@wdes.fr> | 2019-11-06 00:38:37 +0300 |
---|---|---|
committer | William Desportes <williamdes@wdes.fr> | 2019-11-06 00:40:13 +0300 |
commit | 59d6fbec8273c6dfdee4d970cd581e48c3c768fa (patch) | |
tree | d3597331efd2fb3a1f56d7abf389e26bf2419dfe /test | |
parent | f6272067a7e08b435f2ec96b6a6c81e2c637944b (diff) | |
parent | 8d18c801ebea67cb59e5b05011df13f51f38e166 (diff) |
Merge #15556 - Fix Long2IP issue with PHP7.1
Pull-request: #15556
Fixes: #14906
Signed-off-by: William Desportes <williamdes@wdes.fr>
Diffstat (limited to 'test')
-rw-r--r-- | test/classes/Plugins/Transformations/TransformationPluginsTest.php | 20 | ||||
-rw-r--r-- | test/classes/UtilTest.php | 47 |
2 files changed, 67 insertions, 0 deletions
diff --git a/test/classes/Plugins/Transformations/TransformationPluginsTest.php b/test/classes/Plugins/Transformations/TransformationPluginsTest.php index 609c908d20..6962980a0b 100644 --- a/test/classes/Plugins/Transformations/TransformationPluginsTest.php +++ b/test/classes/Plugins/Transformations/TransformationPluginsTest.php @@ -944,6 +944,26 @@ class TransformationPluginsTest extends PmaTestCase ), 'suffixMA_suffix' ), + array( + new Text_Plain_Longtoipv4(), + array(168496141), + '10.11.12.13' + ), + array( + new Text_Plain_Longtoipv4(), + array('168496141'), + '10.11.12.13' + ), + array( + new Text_Plain_Longtoipv4(), + array('my ip'), + 'my ip' + ), + array( + new Text_Plain_Longtoipv4(), + array('<my ip>'), + '<my ip>' + ) ); if (function_exists('imagecreatetruecolor')) { 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', + ], + ]; + } } |