Skip to content

Commit 0e911b9

Browse files
Merge pull request lucee#1912 from zspitzer/LDEV-4334-update-mappings-bug
LDEV-4334 application action="update" mappings=mappings fails
2 parents 6023423 + b7d586f commit 0e911b9

File tree

5 files changed

+66
-1
lines changed

5 files changed

+66
-1
lines changed

test/_testRunner.cfc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ component {
8686
{
8787
onBundleStart = function( cfc, testResults ){
8888
var meta = getComponentMetadata( cfc );
89+
systemOutput( "" , true );
90+
systemOutput(structKeyList(getApplicationSettings().mappings), true );
8991
SystemOut.setOut( out );
9092
//SystemOut.setErr(err);
9193
//"============================================================="

test/functions/ContractPath.cfc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ component extends="org.lucee.cfml.test.LuceeTestCase" {
3131
finally {
3232
// remove mapping /susi
3333
mappings = GetApplicationSettings().mappings
34+
systemOutput(mappings, true );
3435
structDelete( mappings, "/susi", false );
36+
systemOutput(mappings, true );
3537
application action="update" mappings=mappings;
38+
mappings = GetApplicationSettings().mappings
39+
systemOutput(mappings, true );
40+
expect( getApplicationSettings().mappings ).notToHaveKey( "/susi" );
3641
}
3742
}
3843
}

test/functions/ExpandPath.cfc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
---><cfscript>
1919

20-
component extends="org.lucee.cfml.test.LuceeTestCase" {
20+
component extends="org.lucee.cfml.test.LuceeTestCase" labels="mappings" {
2121
/*try{
2222
dir=getDirectoryFromPath(GetBaseTemplatePath());
2323
dir=mid(dir,1,len(dir)-1);

test/tickets/LDEV4334.cfc

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
component extends="org.lucee.cfml.test.LuceeTestCase" labels="mappings" {
2+
3+
function afterAll(){
4+
application action="update" name="LDEV4334-reset-#CreateUniqueID()#";
5+
}
6+
7+
function run( testResults, testBox ) {
8+
describe("Testcase for LDEV4334 mappings, contractPath / ExpandPath", function() {
9+
10+
it( title="check mappings", body=function( currentSpec ) {
11+
application action="update" name="LDEV4334-#CreateUniqueID()#";
12+
res = mappingsTest( "LDEV4334/index.cfm", "with no mapping" );
13+
debug(res);
14+
});
15+
16+
it( title="check mappings", body=function( currentSpec ) localmode=true {
17+
application action="update" name="LDEV4334-#CreateUniqueID()#";
18+
curr = getDirectoryFromPath( getCurrentTemplatePath() );
19+
mappings[ "/susi"]=curr;
20+
application action="update" mappings=mappings;
21+
res = mappingsTest( "LDEV4334/index.cfm", "with single mapping" );
22+
debug(res);
23+
});
24+
25+
});
26+
};
27+
28+
private function mappingsTest ( required string base, required string desc ){
29+
var paths = structNew("ordered");
30+
paths['desc'] = arguments.desc;
31+
paths['base'] = arguments.base;
32+
paths['applicationMappings'] = serializeJson(GetApplicationSettings().mappings);
33+
paths['getCurrentTemplatePath()']= getCurrentTemplatePath();
34+
paths['currentFolder*getDirectoryFromPath(getCurrentTemplatePath())']= getDirectoryFromPath(getCurrentTemplatePath() );
35+
paths['getContextRoot()'] = getContextRoot();
36+
paths['expandPath(#paths.base#)'] = expandPath(paths.base);
37+
paths['expandPath( "." )'] = expandPath( "." );
38+
paths['expandPath( ".." )'] = expandPath( ".." );
39+
paths['expandPath( "./" )'] = expandPath( "./" );
40+
paths['expandPath( "../" )'] = expandPath( "../" );
41+
paths['expandPath( "./" & #paths.base# )'] = expandPath( "./" & paths.base );
42+
paths['expandPath( "/" & #paths.base# )'] = expandPath( "/" & paths.base );
43+
paths['contractPath( #paths.base# )'] = contractPath( paths.base );
44+
paths['contractPath( "." )'] = contractPath( "." );
45+
paths['contractPath( "./" )'] = contractPath( "./" );
46+
paths['contractPath( ".." )'] = contractPath( ".." );
47+
paths['contractPath( "../" )'] = contractPath( "../" );
48+
paths['contractPath( expandPath(#paths.base#) )'] = contractPath( expandPath(paths.base) ) ;
49+
paths['contractPath( expandPath( "./" & #paths.base #) )'] = contractPath( expandPath( "./" & paths.base ) );
50+
paths['contractPath( expandPath( "/" & #paths.base# ) )'] = contractPath( expandPath( "/" & paths.base ) );
51+
systemOutput("", true);
52+
loop collection=paths key="local.key" value="local.value"{
53+
systemOutput(key & chr(9) & value, true);
54+
}
55+
return paths;
56+
}
57+
}

test/tickets/LDEV4334/index.cfm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!--- empty --->

0 commit comments

Comments
 (0)