diff options
author | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-08-13 03:13:24 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauricio@fauth.dev> | 2022-08-13 03:13:24 +0300 |
commit | f57ea109211ee37a72f927024050a5ff2b750b5a (patch) | |
tree | 380b3ebc12fa3dd8e30c776fc230d89f0d128bfc /test | |
parent | 1eb61c99084fd1a80f557860027a80493d16b87d (diff) | |
parent | c78c5e320b9952d332f6638960bcb2025ccae256 (diff) |
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
Diffstat (limited to 'test')
-rw-r--r-- | test/classes/InsertEditTest.php | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/test/classes/InsertEditTest.php b/test/classes/InsertEditTest.php index 0d0776ce62..af43d48400 100644 --- a/test/classes/InsertEditTest.php +++ b/test/classes/InsertEditTest.php @@ -2097,6 +2097,126 @@ class InsertEditTest extends AbstractTestCase ], $result ); + + // Test to see if a zero-string is not ignored + $result = $this->insertEdit->getQueryValuesForInsertAndUpdateInMultipleEdit( + $multi_edit_columns_name, + [], + '0', + [], + [], + false, + [], + [], + "'0'", + [], + '0', + [] + ); + + $this->assertEquals( + [ + ["`fld` = '0'"], + [], + ], + $result + ); + + // Can only happen when table contains blob field that was left unchanged during edit + $result = $this->insertEdit->getQueryValuesForInsertAndUpdateInMultipleEdit( + $multi_edit_columns_name, + [], + '', + [], + [], + false, + [], + [], + '', + [], + '0', + [] + ); + + $this->assertEquals( + [ + [], + [], + ], + $result + ); + + // Test to see if a field will be set to null when it wasn't null previously + $result = $this->insertEdit->getQueryValuesForInsertAndUpdateInMultipleEdit( + $multi_edit_columns_name, + ['on'], + '', + [], + [], + false, + [], + [], + 'NULL', + [], + '0', + [] + ); + + $this->assertEquals( + [ + ['`fld` = NULL'], + [], + ], + $result + ); + + // Test to see if a field will be ignored if it was null previously + $result = $this->insertEdit->getQueryValuesForInsertAndUpdateInMultipleEdit( + $multi_edit_columns_name, + ['on'], + '', + [], + [], + false, + [], + [], + 'NULL', + [], + '0', + ['on'] + ); + + $this->assertEquals( + [ + [], + [], + ], + $result + ); + + // Test to see if a field will be ignored if it the value is unchanged + $result = $this->insertEdit->getQueryValuesForInsertAndUpdateInMultipleEdit( + $multi_edit_columns_name, + [], + "a'b", + ["a'b"], + [], + false, + [], + [], + "'a\'b'", + [], + '0', + [] + ); + + $this->assertEquals( + [ + [], + [], + ], + $result + ); } /** |