Skip to content

Instantly share code, notes, and snippets.

View virtix's full-sized avatar
💭
I may be slow to respond.

bill shelton virtix

💭
I may be slow to respond.
View GitHub Profile
<cfcomponent extends="mxunit.framework.TestCase">
<cffunction name="setUp" returntype="void" access="public" hint="put things here that you want to run before each test">
</cffunction>
<cffunction name="tearDown" returntype="void" access="public" hint="put things here that you want to run after each test">
</cffunction>
<cfcomponent hint="A really stupid component">
<cffunction name="echo">
<cfargument name="arg" />
<cfreturn arguments.arg />
</cffunction>
</cfcomponent>
<cfcomponent extends="mxunit.framework.TestCase">
<cfscript>
function setUp(){
plainOldComponent = createObject("component" ,"PlainOldStupidAssCFC");
assertSame(plainOldComponent,plainOldComponent);
}
...
</cfscript>
</cfcomponent>
function uselessUltraRedundantCallbackForMorons(){
var callBackFunc = plainOldComponent.echo( plainOldComponent.echo(plainOldComponent.echo) );
assertEquals('I LIKE spam.', callBackFunc('I LIKE spam.') );
}
function freakinIdioticInvocationUsingPageContextAndRequestScope(){
var localFunc = 'localFunc';
var page = getPageContext().getRequest().setAttribute( localFunc , plainOldComponent.echo );
assertEquals('Hey, let''s hang out at BestBuy and give the computer staff shit.', request.localFunc('Hey, let''s hang out at BestBuy and give the computer staff shit.') );
}
function loserJavaWeanieInvocationUsingCfJspPage(){
var page = getPageContext().getPage();
var actual = page.createObject('java','java.lang.String').init(chr(0));
var args = ['hey, loser, you suck.'];
actual = createObject('java' ,'coldfusion.runtime.CfJspPage')._invokeUDF(page._get('plainOldComponent.echo'), 'echo', page, args);
debug(actual);
assertEquals( 'hey, loser, you suck.', actual );
}
function boneheadedTimeWasterWalkingAroundInCirclesLikeADoucheBag(){
var actual = getPageContext().getFusionContext().parent.plainOldComponent.echo('Now this is a fucking waste of time');
assertEquals('Now this is a fucking waste of time', actual);
}
function two_Totally_DumbAssWaysOfInvokingFunctionsUsingFusionContextAndCFCProxy(){
var ctx = getPageContext().getFusionContext();
var stupidCfcPath = ctx.parent.getDirectoryFromPath(ctx.getPagePath()) & 'PlainOldStupidAssCFC.cfc';
var cfcproxy = CreateObject("java", "coldfusion.cfc.CFCProxy").init(stupidCfcPath);
var args = ['dumb ass puke breath punk'];
var alias = cfcproxy.getMethod('echo');
assertEquals( args[1] , alias('dumb ass puke breath punk') );
assertEquals( args[1] , cfcproxy.invoke('echo', args) );
}
function wasteMoreTimeYouTurdSuckingMongralFromAnotherPlanet(){
var args = ['Yow! Am I having fun yet?'];
var ctx = getPageContext().getFusionContext();
var actual = ctx.parent._invoke( ctx.parent.createObject('component','PlainOldStupidAssCFC'), 'echo', args );
debug(actual);
assertEquals( args[1] , actual );
}
function getAFuckingLifeYouAsshatMonkeyShitHurler() {
var null = '';
var methodProxy = javacast('null',chr(0));
var args = {1='scum sucking asshat-wearing Neanderfuck'};
var ctx = getPageContext().getFusionContext();
ctx.parent._set('methodProxy', ctx.parent.createObject('java','coldfusion.runtime.java.JavaProxy').init( ctx.parent._autoscalarize( ctx.parent._get('plainOldComponent').echo )) );
actual = methodProxy.invoke(null, null, ctx.parent, args);
debug(actual);
assertEquals( 'scum sucking asshat-wearing Neanderfuck' , actual );
}