lundi 31 août 2015

Symfony2 adding tests for saving api feed to database

I'm working on my first major symfony2 project.

I have updated an api that's no longer being maintained by the original author. http://ift.tt/1KWMhhU

The updated API contains all the necessary Unit and Integration Tests for the different API Calls. Including Mocks of the data feeds that come from the API.

I've now written a symfony2 bundle that uses this api via console commands and saves the data from the feeds to the database. FP_DataBundle

My question is about testing: Can i use the same mocks that are in my FantasyDataAPI library to test that the correct data is being saved to the database?

I'm thinking that i need the tests to execute the console commands and then fetch the data from the database and then go through the mocks and check that that the data in the DB Matches.

Can i create a database version that just holds the mock data and then test against that db? How can i do that?

Is my thinking askew and i need to do it another way, the feeds contain a lot of fields in json format, and duplicating all these in my bundle again seems like overkill.

Aucun commentaire:

Enregistrer un commentaire