diff options
author | William Desportes <williamdes@wdes.fr> | 2021-04-19 22:40:10 +0300 |
---|---|---|
committer | William Desportes <williamdes@wdes.fr> | 2021-04-19 22:51:45 +0300 |
commit | 8fbb01a6849dd2036bd17d5bdbf5ebb93c979162 (patch) | |
tree | 92d6cc1087ede6b11d1b40fe03e4b101623569d9 /test | |
parent | 90778eecf723a20ec8f42fbfe3ea6891fe9f97c9 (diff) | |
parent | 2b8468cb2cd347b4f6626b7a6e0fb503deb7331a (diff) |
Merge branch 'origin/QA_5_1'
Signed-off-by: William Desportes <williamdes@wdes.fr>
Diffstat (limited to 'test')
-rw-r--r-- | test/classes/Display/ResultsTest.php | 52 | ||||
-rw-r--r-- | test/classes/UtilTest.php | 57 |
2 files changed, 106 insertions, 3 deletions
diff --git a/test/classes/Display/ResultsTest.php b/test/classes/Display/ResultsTest.php index c4d218e617..d32b3a1dd2 100644 --- a/test/classes/Display/ResultsTest.php +++ b/test/classes/Display/ResultsTest.php @@ -869,7 +869,7 @@ class ResultsTest extends AbstractTestCase [], 0, 'binary', - 'class="disableAjax">[BLOB - 4 B]</a>' . "\n" + 'class="disableAjax">[BLOB - 4 B]</a>' . '</td>' . "\n", ], [ @@ -890,8 +890,8 @@ class ResultsTest extends AbstractTestCase [], 0, 'binary', - '<td class="text-start grid_edit transformed hex">' . "\n" - . ' 1001' . "\n" + '<td class="text-start grid_edit transformed hex">' + . '1001' . '</td>' . "\n", ], [ @@ -1283,4 +1283,50 @@ class ResultsTest extends AbstractTestCase '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('<td class="text-start my_class"> special value </td>' . "\n", $output); + $output = $this->callFunction( + $this->object, + DisplayResults::class, + 'buildValueDisplay', + [ + 'my_class', + false, + '0x11e6ac0cfb1e8bf3bf48b827ebdafb0b', + ] + ); + $this->assertSame( + '<td class="text-start my_class">0x11e6ac0cfb1e8bf3bf48b827ebdafb0b</td>' . "\n", + $output + ); + $output = $this->callFunction( + $this->object, + DisplayResults::class, + 'buildValueDisplay', + [ + 'my_class', + true,// condition mode + '0x11e6ac0cfb1e8bf3bf48b827ebdafb0b', + ] + ); + $this->assertSame( + '<td class="text-start my_class condition">0x11e6ac0cfb1e8bf3bf48b827ebdafb0b</td>' . "\n", + $output + ); + } } diff --git a/test/classes/UtilTest.php b/test/classes/UtilTest.php index 2b10ab338e..203583e393 100644 --- a/test/classes/UtilTest.php +++ b/test/classes/UtilTest.php @@ -164,6 +164,63 @@ class UtilTest extends AbstractTestCase ) ); $this->assertSame( + ['= \'value\'', ''], + $this->callFunction( + null, + Util::class, + 'getConditionValue', + [ + 'value',// row + new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) [ + 'numeric' => false, + 'type' => 'blob', + 'charsetnr' => 32,// armscii8_general_ci + ]),// field meta + 0,// fields count + '',// condition key + '',// condition + ] + ) + ); + $this->assertSame( + ['= \'value\'', ''], + $this->callFunction( + null, + Util::class, + 'getConditionValue', + [ + 'value',// row + new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) [ + 'numeric' => false, + 'type' => 'blob', + 'charsetnr' => 48,// latin1_general_ci + ]),// field meta + 0,// fields count + '',// condition key + '',// condition + ] + ) + ); + $this->assertSame( + ['= CAST(0x76616c7565 AS BINARY)', ''], + $this->callFunction( + null, + Util::class, + 'getConditionValue', + [ + 'value',// row + new FieldMetadata(MYSQLI_TYPE_STRING, 0, (object) [ + 'numeric' => false, + 'type' => 'blob', + 'charsetnr' => 63,// binary + ]),// field meta + 0,// fields count + '',// condition key + '',// condition + ] + ) + ); + $this->assertSame( ['= CAST(0x76616c7565 AS BINARY)', ''], $this->callFunction( null, |