Skip to content

Commit

Permalink
test cleanup, avoid crash when reflection disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Nov 25, 2024
1 parent 92b3e81 commit c6cf313
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 50 deletions.
96 changes: 49 additions & 47 deletions test/tickets/LDEV1770.cfc
Original file line number Diff line number Diff line change
@@ -1,53 +1,55 @@
component extends="org.lucee.cfml.test.LuceeTestCase" labels="xml"{
function run( testResults , testBox ) {
describe( "Test suite for LDEV-1770", function() {
var getArt= QueryNew( "ARTID,ARTNAME,DESCRIPTION,ISSOLD,MEDIATYPE" );
QueryAddRow( getArt, 3 );

QuerySetCell( getArt, "ARTID", "1", 1 );
QuerySetCell( getArt, "DESCRIPTION", "Test desc 1", 1 );
QuerySetCell( getArt, "ARTNAME", "Picaso 1", 1 );

QuerySetCell( getArt, "ARTID", "2", 2 );
QuerySetCell( getArt, "DESCRIPTION", "Test desc 2", 2 );
QuerySetCell( getArt, "ARTNAME", "Picaso 2", 2 );

QuerySetCell( getArt, "ARTID", "3", 3 );
QuerySetCell( getArt, "DESCRIPTION", "Test desc 3", 3 );
QuerySetCell( getArt, "ARTNAME", "Picaso 3", 3 );

var feedMeta = structNew();
var feedMeta.description = "ColdFusion Art Gallery XML Feed";
var feedMeta.link = "http://coldfusionexamples.com/";
var feedMeta.title = "Art";
var feedMeta.version = "rss_2.0";

var colMap = structNew();
var colMap.content = "DESCRIPTION";
var colMap.rsslink = "ARTID";
var colMap.title = "ARTNAME";

cffeed (action="create" query="#getArt#" columnMap="#colMap#" properties="#feedMeta#" xmlVar="feedXML");
var testContent = xmlParse(feedXML);

it( title="Checking 'item' with 'title' node as empty ", body=function( currentSpec ) {
local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[1].XmlText;
expect(local.result).toBe('Picaso 1');
});

xit( title="Checking 'item' with 'desc' node as empty", body=function( currentSpec ) {
local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[2].XmlText;
expect(local.result).toBe('1');
});

xit( title="Checking 'item' contains 'link' node", body=function( currentSpec ) {
local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[2].xmlName;
expect(local.result).toBe('link');
});

it( title="Checking 'item' contains three nodes", body=function( currentSpec ) {
local.result = arrayLen(testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren);
expect(local.result).toBe('3');
it(title="Checking the CFFEED tag", body=function( currentSpec ) {
var getArt= QueryNew( "ARTID,ARTNAME,DESCRIPTION,ISSOLD,MEDIATYPE" );
QueryAddRow( getArt, 3 );

QuerySetCell( getArt, "ARTID", "1", 1 );
QuerySetCell( getArt, "DESCRIPTION", "Test desc 1", 1 );
QuerySetCell( getArt, "ARTNAME", "Picaso 1", 1 );

QuerySetCell( getArt, "ARTID", "2", 2 );
QuerySetCell( getArt, "DESCRIPTION", "Test desc 2", 2 );
QuerySetCell( getArt, "ARTNAME", "Picaso 2", 2 );

QuerySetCell( getArt, "ARTID", "3", 3 );
QuerySetCell( getArt, "DESCRIPTION", "Test desc 3", 3 );
QuerySetCell( getArt, "ARTNAME", "Picaso 3", 3 );

var feedMeta = structNew();
var feedMeta.description = "ColdFusion Art Gallery XML Feed";
var feedMeta.link = "http://coldfusionexamples.com/";
var feedMeta.title = "Art";
var feedMeta.version = "rss_2.0";

var colMap = structNew();
var colMap.content = "DESCRIPTION";
var colMap.rsslink = "ARTID";
var colMap.title = "ARTNAME";

cffeed (action="create" query="#getArt#" columnMap="#colMap#" properties="#feedMeta#" xmlVar="feedXML");
var testContent = xmlParse(feedXML);

it( title="Checking 'item' with 'title' node as empty ", body=function( currentSpec ) {
local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[1].XmlText;
expect(local.result).toBe('Picaso 1');
});

xit( title="Checking 'item' with 'desc' node as empty", body=function( currentSpec ) {
local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[2].XmlText;
expect(local.result).toBe('1');
});

xit( title="Checking 'item' contains 'link' node", body=function( currentSpec ) {
local.result = testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren[2].xmlName;
expect(local.result).toBe('link');
});

it( title="Checking 'item' contains three nodes", body=function( currentSpec ) {
local.result = arrayLen(testContent.XmlRoot.XmlChildren[1].XmlChildren[4].XmlChildren);
expect(local.result).toBe('3');
});
});
});
}
Expand Down
8 changes: 5 additions & 3 deletions test/tickets/LDEV2113.cfc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
component extends="org.lucee.cfml.test.LuceeTestCase" labels="xml" {

variables.xml=xmlparse('<?xml version="1.0" encoding="UTF-8"?>
variables.xml='<?xml version="1.0" encoding="UTF-8"?>
<shiporder orderid="889923"
xmlns="http://webservice.example.com/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All @@ -23,7 +23,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="xml" {
<quantity>1</quantity>
<price>9.90</price>
</item>
</shiporder>');
</shiporder>';

variables.schema='<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
Expand Down Expand Up @@ -57,7 +57,9 @@ component extends="org.lucee.cfml.test.LuceeTestCase" labels="xml" {
</xs:complexType>
</xs:schema>';


function beforeAll(){
variables.xml = xmlParse( variables.xml );
};

function run( testResults , testBox ) {
describe( "test case for LDEV-2113", function() {
Expand Down

0 comments on commit c6cf313

Please sign in to comment.