Closed matthewjumpsoffbuildings closed 8 months ago
Please add a test that runs this code.
Im actually not sure how to test this? Since dropAll() returns void, how would I test if it exited early due to there being no tables, or if it exited later because it found and dropped some tables?
I'm ok as long as all the code paths are covered.
So you can just run Connection::dropAllTables with no tables and just $this->assertTrue(true);
.
added test_dropAllTablesEmpty(), that should cover it?
It appears to work when I run it, but I am not sure about a couple of things
Does that test_dropAllTablesEmpty() get run last in the file? If so it will be okay since the previous test_dropAllTables() will have emptied the db. Or do the test methods in the file get called in any order, in which case does each test method start with an empty database, or do artefacts from previous tests persist?
I think tests that depend on other tests to be run first is really bad.
So ideally, there should be a hook which deletes all created tables after every test, but that slows down the entire test significantly. As a compromise, I think you should drop all tables twice in this test. Once to actually clear all tables, and 2nd run which will guarantee that the given code is run.
Done
Please add a changelog
Updated the changelog, not sure if its a new point release, please edit if needed
Also should we add #191 and #192 to the changelog too?
Also should we add https://github.com/colopl/laravel-spanner/pull/191 and https://github.com/colopl/laravel-spanner/pull/192 to the changelog too?
Yes but I'd like to have a different PR for them.
Yes but I'd like to have a different PR for them.
Do you want me to do anything or you got it?
I'd appreciate it if you can write the ones for the previous two. Thanks.
Which branch should I do it on?
master for all unreleased features.
Small tweak to Schema Builder dropAll() - if no tables exists simply return immediately