The first working test and the set up.
Code for this post here; requires
composer update to run.
Gathering the test material
Since the plugin will rely on the use of Etsy API it makes sense to start my development from there and to both get my feet wet and gather some testing material I’ve dumped some simple API query results to file.
To keep with the project scope I do not need the full power of the Etsy API but just two basic queries:
after the mandatory app registration and some URI fiddling I’ve dumped the results of the queries to two
.json files I can use in tests.
Back to Composer for autoloading
I’ve been tempted to use my PHP 5.2 compatible autoload generator for the project but since I will be pulling the project dependencies in using Composer it makes little sense to duplicate the functions.
Recent updates to Composer broke the compatibility with the package I was previously using but a fellow and helping developer forked the project making the possibility real again.
First tests and first class
The first class I’m developing is the one in charge of fetching the data about a user shops and listings following the chain of responsibility: the class
ELH_Synchronizer single responsibility is to start the sync and wait for it to either happen or fail.
I’ve set up the project to be able to run the first test and make it pass.
The chain of syncing in place it’s time to dig into the single sync steps; I will take a detour to illustrate some solutions I’ve used in the code like a dependency injection container and function-mocker.