lundi 31 décembre 2018

Laravel testing function to see any changes in a database

I need a function that would give me a list of tables and records that was done by some php code. This function is going to be executed from a unit test.

My idea to set a time by a Carbon, execute some php code, and then run this function that would get a list of all the tables in the database and run a select for each table looking for the specific date at created-at and updated-at fields..

Than it returns a collection of records created in the batabase grouped by table name.

Alternatively, if I'd be happy to get a list of modifications made by database transaction.

I don't know if such function exists somewhere on MySQL level or maybe in Laravel, or PHPUnit.

If it doesn't exist, please help me write it. Thank you.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire