Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add automatic database backup for in situ PHPUnit testing #14

Open
bobbingwide opened this issue Dec 2, 2016 · 2 comments
Open

Add automatic database backup for in situ PHPUnit testing #14

bobbingwide opened this issue Dec 2, 2016 · 2 comments
Assignees

Comments

@bobbingwide
Copy link
Owner

This is belt and braces stuff. When running the native WP_UnitTestCase class for WordPress 4.7 the database is magically emptied. This is the exact opposite of what's required for In situ testing. To protect against this we could add some logic to automatically backup the environment's database if it hasn't already been backed up that day.

@bobbingwide bobbingwide self-assigned this Dec 2, 2016
@bobbingwide
Copy link
Owner Author

On 7th March 2016 I wrote a simple backup.bat file

@echo (C) Copyright Bobbing Wide 2016
rem See also the unstarted backup-qw plugin
rem 
rem  mysqldump -u root -p oikplug_wp993 > oikplug_wp993-0225-dropped.sql
setlocal
cd \backups-qw\qw\sqldumps

rem mm/dd/yyyy
rem echo %date%
set mydate=%date:~6,4%%date:~0,2%%date:~3,2%

echo %1-%mydate%.sql
pause
mysqldump -u root -p %1 > %1-%mydate%.sql
endlocal

@bobbingwide
Copy link
Owner Author

The simple backup produced using mysqldump with only the basic parameters

mysqldump -h %s -u %s --password=%s %s --result_file=%s

does not contain enough information to rebuild a database from scratch.
It's missing:

  • Indexes
  • Auto increments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant