Skip to content

Commit

Permalink
Added a testcase for LDEV-4325 (#2213)
Browse files Browse the repository at this point in the history
* Added a testcase for LDEV-4325

* Update LDEV4325.cfc
  • Loading branch information
cfmitrah authored Sep 8, 2023
1 parent 7b11bb2 commit 3e21b4d
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions test/tickets/LDEV4325.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
component extends="org.lucee.cfml.test.LuceeTestCase" skip=true {

function beforeAll() {
variables.mySQL = server.getDatasource("mysql");
if( structCount(mySQL) ) {
application action="update" datasource=mySQL;

query{
echo( "DROP TABLE IF EXISTS testnotes" );
}
query{
echo( "CREATE TABLE `testnotes` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`notes` MEDIUMTEXT NOT NULL COLLATE utf16_bin,
PRIMARY KEY (`id`) USING BTREE
) COLLATE=latin1_swedish_ci ENGINE=InnoDB" );
}
}
}

function afterAll() {
if (!notHasMysql()) {
queryExecute( sql = "DROP TABLE IF EXISTS testnotes" );
}
}

function run( testResults, testBox ) {
describe( title = "Testcase for LDEV-4325", body = function() {
it( title = "Checking Cf_sql_clob", skip = "#notHasMysql()#", body = function( currentSpec ) {
st = structNew();
st.ID = 1;
st.NAME = "Water";
st.DESIGNATION = "Important source for all";
st.DATA = 1;
notes = st.toJson();
QueryExecute(
sql = "INSERT INTO `testnotes` ( notes ) VALUES ( :notes )",
params = {
notes: { value: notes, type: "clob" }
}
);
qry = QueryExecute(
sql: "SELECT notes from `testnotes`"
);
expect( qry.notes ).toBe( '{"DATA":1,"DESIGNATION":"Important source for all","NAME":"Water","ID":1}' );
});
});
}

private function notHasMysql() {
return structCount( server.getDatasource("mysql") ) == 0;
}
}

0 comments on commit 3e21b4d

Please sign in to comment.