Phake Framework and Stripe

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    Phake Framework and Stripe

    i have a situation where i have to test the functionality of my site's user subscriptions on stripe. i have to do integration testing for the cancel plans functionality on my site using php unit and php-facebook-webdrivers, according to my knowledge it is not a good practice to create users on stripe from within my test cases, i heard the term mocking, what it does that it stubs the function and returns whatever you want to return for any method inside a class which is mocked, so i decided that when i will mock the
    Code:
    Stripe_Subscription::cancel()
    method to return my desired response rather than sending the call to stripe, i found the Phake php framework Phake which is used for this purpose.

    But i cant get it to work with stripe calls, may be there is a possibility that i havent understood the concept correctly, they have provided example there but it works only with the interface class not the normal classes, can anyone tell me how to mock a simple class or if it is possible, because i cant find any community forum for Phake and it is really hard as it is the first time i am working on any such thing , i can provide my code also if required.

    regards,

    omer aslam
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    i found the Phake php framework Phake which is used for this purpose.
    if you use PHPUnit for testing, that brings its own mocking/stubbing, so there’s no need to use something external.

    otherwise it depends on what you use for unit testing.

    Comment

    • omerbutt
      Contributor
      • Nov 2006
      • 638

      #3
      Thanks for the reply dormilich, yes you are right about hte mocking in PHPunit , but it appears to be that stripe has not yet supported to mock its methods , it works purely on static methods and calls , and there is no way yet that we could mock it yet
      regards,
      Omer Aslam

      Comment

      Working...