ColdFusion bug found. Can MockBox work around it?

I discovered what I would consider a ColdFusion bug that causes MockBox $args() to fail to work as expected. The ++ operator in ColdFusion converts an integer to a double. MockBox uses the Java TreeMap class to convert the argumentCollection values into a single string which it then hashes. It does this when we mock the methods and when the methods are invoked and compares the two to see which mocked result it should return.

<cfset i++>
<cfset treeMap = createObject(“java”,“java.util.TreeMap”).init({key=i})>

If we are using $args() to mock method calls where one of the arguments is incremented and we start with an integer we expect the other indexes to also be an integer.

MockBox = createObject('coldbox.system.testing.MockBox').init();

Stub = MockBox.createStub();
Stub.$(method = “someMethod”).$args(1).$results(1);
Stub.$(method = “someMethod”).$args(2).$results(2); // we expect the second time the method is called to be with an integer

for(i=1; i lte 2; i++) {
writeDump(Stub.someMethod(i));
}

I don’t know if I explained this very well, but you can drop the above into a .cfm file. You can work around this if you know the behavior. I’m just wondering if there is some way we can modify mockbox to account for this?

I’ve refactored MockBox.normalizeArguments in a way that I think will work around the issue. Is there a guide somewhere for how to checkout MockBox from git and submit a pull request?

I’m not familiar with Git at all.

Seth–

I’d start with the GitHub docs themselves: https://help.github.com/articles/fork-a-repo (also has a link in the article for pull request documentation)

They describe the process pretty nicely.