From ae4518be9b67b4a8e4fa837265019baab804e2d4 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Mon, 19 Apr 2021 19:00:35 +0200 Subject: [PATCH] Add tests for #16836 Signed-off-by: William Desportes --- test/classes/Display/ResultsTest.php | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/test/classes/Display/ResultsTest.php b/test/classes/Display/ResultsTest.php index 58a656dabbce..29b32448dd62 100644 --- a/test/classes/Display/ResultsTest.php +++ b/test/classes/Display/ResultsTest.php @@ -1296,4 +1296,50 @@ public function testGetSortOrderHiddenInputs( 'The first line should contain the URL params' ); } + + /** + * @see https://github.com/phpmyadmin/phpmyadmin/issues/16836 + */ + public function testBuildValueDisplayNoTrainlingSpaces(): void + { + $output = $this->callFunction( + $this->object, + DisplayResults::class, + 'buildValueDisplay', + [ + 'my_class', + false, + ' special value ', + ] + ); + $this->assertSame(' special value ' . "\n", $output); + $output = $this->callFunction( + $this->object, + DisplayResults::class, + 'buildValueDisplay', + [ + 'my_class', + false, + '0x11e6ac0cfb1e8bf3bf48b827ebdafb0b', + ] + ); + $this->assertSame( + '0x11e6ac0cfb1e8bf3bf48b827ebdafb0b' . "\n", + $output + ); + $output = $this->callFunction( + $this->object, + DisplayResults::class, + 'buildValueDisplay', + [ + 'my_class', + true,// condition mode + '0x11e6ac0cfb1e8bf3bf48b827ebdafb0b', + ] + ); + $this->assertSame( + '0x11e6ac0cfb1e8bf3bf48b827ebdafb0b' . "\n", + $output + ); + } }