Skip to content

Commit

Permalink
BL-970 Resolve - add handling for legacy method signature
Browse files Browse the repository at this point in the history
  • Loading branch information
jclausen committed Jan 23, 2025
1 parent 1a10efb commit 33e2ab7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import ortus.boxlang.runtime.types.Argument;
import ortus.boxlang.runtime.types.XML;
import ortus.boxlang.runtime.types.exceptions.BoxRuntimeException;
import ortus.boxlang.runtime.util.ValidationUtil;

@BoxBIF
public class XMLElemNew extends BIF {
Expand Down Expand Up @@ -74,6 +75,12 @@ public Object _invoke( IBoxContext context, ArgumentsScope arguments ) {

Node documentNode = xmlObject.getNode();

// Backward compat for the weird ACF and Lucee method signature
if ( ValidationUtil.isValidURL( childName ) ) {
childName = namespace;
namespace = arguments.getAsString( Key.childname );
}

if ( documentNode == null ) {
String xmlString = null;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,25 @@ public void testNodeReturn() {

}

@DisplayName( "It can accept namespace arg as second argument" )
@Test
public void testNameSpaceTwo() {
instance.executeSource(
"""
envelope = xmlParse( "<soapenv:Envelope xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/""><soapenv:Header/><soapenv:Body/></soapenv:Envelope>" );
soapBody = envelope.xmlRoot[ "soapenv:Body" ];
result = xmlElemNew(
soapBody,
"http://services.rccl.com/Interfaces/GroupList",
"getGroupList"
);
""",
context );
assertTrue( variables.get( result ) instanceof XML );
// assertEquals( "BoxLang", variables.getAsString( result ) );

}

@DisplayName( "Tests some typing and abstraction of XML objects" )
@Test
@Disabled
Expand Down

0 comments on commit 33e2ab7

Please sign in to comment.