Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests to validate request xml payloads #6

Closed
sahanh opened this issue Aug 20, 2014 · 3 comments
Closed

Tests to validate request xml payloads #6

sahanh opened this issue Aug 20, 2014 · 3 comments

Comments

@sahanh
Copy link

sahanh commented Aug 20, 2014

I got few unexpected method exceptions when doing API calls (issue #5 ) and since there were no tests to validate actual xml payload, I implemented my own.

https://github.com/sahanh/infusionsoft-php/tree/develop

Here's how an actual service call is validated

class InvoiceServiceTest extends \ServiceTest
{

    public function testCreateBlankOrder()
    {
        $this->ifs->invoices->createBlankOrder(111, 'hello world', new \DateTime('2014-08-08'), 2, 3);
        $this->verifyCall('InvoiceService.createBlankOrder');
    }
}

image

By default the final request will be validated against a preset xml file under tests/Infusionsoft/Api/fixtures, but it can be overridden.

I'm using aspect mock and it requires php 5.4. Thought of sharing it with you guys.

Thanks.

@andrewryno
Copy link
Contributor

I personally love the idea of using fixtures to get some proper tests for the calls. Could you rebase with develop and squash the commits?

@sahanh
Copy link
Author

sahanh commented Sep 19, 2014

I'm not sure if I follow you correctly, looks like my develop branch is update to date and commits are in develop branch.

@andrewryno
Copy link
Contributor

Sorry, problem on my end. Looks good. Can you open a pull request so I can merge it into develop? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants