richard.herbert
08/15/2022, 1:54 PMcgi
scope?aliaspooryorik
variables.CGI
scoped variable before it looks for the actual CGI scope (due to the order ACF does scope hunting) so you can do sut.$property("CGI", "variables", {});
richard.herbert
08/15/2022, 2:16 PMcgi.QUERY_STRING
so I can refactor the sh!t out of it.
And that trick is ACF only, not Lucee?aliaspooryorik
richard.herbert
08/15/2022, 2:18 PMaliaspooryorik
cgi.QUERY_STRING
into a new function in the component under test and then mock what that function returns.aliaspooryorik
richard.herbert
08/15/2022, 2:21 PMrichard.herbert
08/15/2022, 2:21 PMAdam Cameron
richard.herbert
08/15/2022, 2:32 PMcgi
but that might have been at the web server level I'm remembering.
I would say more "_don't depend on the CGI scope as it can vary between web servers_".Adam Cameron
Request
object instance, which contains something like a cgi
property which has data from the CGI scope in it. Even a controller method should "never" access the CGI scope.
Nothing beyond the controller should be fussing with the sort of values that come from the CGI scope I reckon. Maybe some property value derived from something in the CGI scope, but not like CGI.remote_addr
etcaliaspooryorik
joechastain
08/17/2022, 4:49 PMCan I mock theWhat did the cgi scope do to deserve mockery?scope?cgi
richard.herbert
08/17/2022, 4:50 PMjoechastain
08/17/2022, 4:51 PMrichard.herbert
08/17/2022, 4:53 PMcgi.QUERY_STRING
to loop over and then pass onto another component...
<cfloop index="pair" list="#cgiQueryString()#" delimiters="&">
<cfset argument_name = listFirst(pair, "=")>
<cfset argument_name = REReplace(urlDecode(argument_name),'<[^>]*>','','all')>
<cfset argument_value = urlDecode(listLast(pair, "="))>
<cfset "passInArgs.#argument_name#" = argument_value>
</cfloop>
richard.herbert
08/17/2022, 4:55 PM