phpunit-test-runner icon indicating copy to clipboard operation
phpunit-test-runner copied to clipboard

drop test tables on cleanup

Open mrxkon opened this issue 4 years ago • 3 comments
trafficstars

Fixes #110

Adds functionality to remove test tables from the database during cleanup.

mrxkon avatar Jan 12 '21 18:01 mrxkon

Thanks much for the PR!

I took a look, and I think this wouldn't work as expected when the database is only accessible from the test environment (when the test environment is not the same as the prepare one).

You can see an example in cleanup.php of how it's done for removing files.

Maybe something similar to that would work?

getsource avatar Jan 15 '21 13:01 getsource

Hey @getsource , sure yeah, that's why I mentioned it in the issue comment since I'm only working locally :D .

If mysql is in general accessible everywhere ( since we're either way using shell_exec and other direct cli access as well ) we can go for oneliners like mysql -u $user -p$pass $db -e "drop table if exists $table;" and just iterate with that as a direct shell (and overssh) command.

This would work both locally and remotely I suppose.

mrxkon avatar Jan 15 '21 13:01 mrxkon

Ah, sorry, I missed the issue comment!

Yes, I think something like that makes sense. The only thing that comes to mind is that I think that would result in the MySQL password being stored in logs.

getsource avatar Jan 15 '21 14:01 getsource