Skip to content

Ease interception of flash_proxy methods #59

@drewbourne

Description

@drewbourne

For classes that extend Proxy Mockolate should intercept all the flash_proxy methods in order to allow use of expect().

Currently users have to do this:

mock(proxyObject).nsMethod(flash_proxy, "callProperty").args("actualMethodName", arg1, arg2).returns(result);
mock(proxyObject).nsMethod(flash_proxy, "getProperty").args("actualPropertyName", arg1, arg2).returns(result);
mock(proxyObject).nsMethod(flash_proxy, "setProperty").args("actualPropertyName", value);
mock(proxyObject).nsMethod(flash_proxy, "hasProperty").args("actualPropertyName").returns(true);

When they should be able to do this:

expect(proxyObject.actualMethodName(arg1, arg2)).returns(result);
expect(proxyObject.actualPropertyName).returns(result);
expect(proxyObject.actualPropertyName = value).returns(result);
expect("actualPropertyName" in proxyObject).returns(true);

Support for property access should also be added.

expect(proxyObject[0]).returns(indexValue);
expect(proxyObject["propertyName"]).returns(propertyvalue);

Support for property iteration should also be added.

mock(proxyObject).asProxy().withItems([ 1, 2, 3 ]);
for each (var item:* in proxyObject) { ... }
mock(proxyObject).asProxy().withProperties({ one: 1, two: 2, three: 3 });
for (var key:* in proxyObject) {  
   var value:* = proxyObject[key];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions