ios - Is there a way to change one of parameters in OCMock and continue running the stubbed function -


hello i'm trying change parameter of function have stubbed. see in logs stub called successfully, , want change 1 of paramters , run original function. can ocmock?

here's i'm doing:

....   id testmgrmock = [ocmockobject partialmockforobject:testclassinstance];  ocmstub([testmgrmock addrequestwithmethod:ocmock_any                                      path:ocmock_any                                parameters:ocmock_any                                   headers:ocmock_any                                      body:ocmock_any                                  delegate:ocmock_any                              successblock:ocmock_any                              failureblock:ocmock_any]). anddo(^(nsinvocation* invocation){     nsstring* path = @"http://addressnotexi.st";     [invocation setargument:&path atindex:2];      // here want call "addrequestwithmethod:path:parameters:header (etc)"      // on real object parameter "path" changed string      [invocation invoke]; }); ...... 

the line [invocation invoke]; gives me bad_exec crash. if don't change parameter.

how properly? possible @ all?

thank you

i found problem

need reaarange code in following way:

before @implementation:

nsstring invalidpath = @"http://theaddressthatdoesnotexis.ts"; 

and code this:

....   id testmgrmock = [ocmockobject partialmockforobject:testclassinstance];  ocmstub([testmgrmock addrequestwithmethod:ocmock_any                                      path:[ocmarg isnotequal:invalidpath]                                parameters:ocmock_any                                   headers:ocmock_any                                      body:ocmock_any                                  delegate:ocmock_any                              successblock:ocmock_any                              failureblock:ocmock_any]). anddo(^(nsinvocation* invocation){     [invocation setargument:&invalidpath atindex:3];     [invocation invoke]; }); ...... 

in shorter words. invoke working if calling itself


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -