piwik/piwik — pull request #5884 by diosmosis (2014-07-26 14:16:14+00:00)
Title: Integration Tests refactor (move API testing logic to separate classes)

Refactoring of IntegrationTestCase for code clarity and cleanliness. Reduces the size of IntegrationTestCase.php and removes a lot of testing hacks.

Includes the following changes:

- moved all API URL generation logic & API response handling logic to separate classes
- created ApiTestConfig class to hold API test options (and documentation for properties)
- remove unnecessary IntegrationTestCase properties and methods (including apiNotToCall/apiToCall)
- remove as many unnecessary API test options as possible (including abandonedCarts, hackDeleteRangeArchivesBefore)
- rename checkRequestResponse to assertApiResponseHasNoError
- cleaned up API/Request::__construct handling of arrays (allows arrays to be used as test requests instead of actual URLs)

Verification:

I verified that all tests are being executed (master & this branch execute the same test cases and same API test URLs). There is a difference in the number of assertions reported by phpunit, however:

Integration 998 (master) => 997 (tests refactor)
Plugin 2489 (master) => 2481 (tests refactor)
Core 1257 (master) => 1259 (tests refactor)

I can't locate the cause of the discrepancy, but I don't think it matters considering the same amount of API urls and test cases are tested.