You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for running tests against SQLite database (#181)
* Add support for running tests against SQLite database
This adds support for the SQLite Database Integration plugin, which allows WordPress to be installed using a SQLite databse instead of MySQL.
If the environment variable DB_TYPE is set to SQLITE then we will install the SQLite Database Integration plugin and uses its db.php dropin to addn SQLite support to the copy of WordPress that tests are run against.
* Update src/Context/FeatureContext.php
Co-authored-by: Pascal Birchler <[email protected]>
* Suggested changes
* Change this logic since exiting tests do not define DB_TYPE
* Make sure cached core files are in the proper state
When switching between MySQL and SQLite behat might use the same set of cached core files, so make sure they are set up properly to use the correct database method for the current run.
* Fix phpunit tests to work with new tags
* Fix more phpunit tests
* Remove previous hardcoded cache dir
* Make downloading and configuring sqlite two separate steps per suggetions
Now we can keep one cached copy of the plugin separate from core WordPress files and only use it when DB_TYPE=sqlite
* Fix Typo
* Update FeatureContext.php
Co-authored-by: Pascal Birchler <[email protected]>
* Remove db type check
---------
Co-authored-by: Pascal Birchler <[email protected]>
@@ -45,6 +45,11 @@ class FeatureContext implements SnippetAcceptingContext {
45
45
*/
46
46
privatestatic$install_cache_dir;
47
47
48
+
/**
49
+
* The directory that holds a copy of the sqlite-database-integration plugin, and which is copied to RUN_DIR during a "Given a WP installation" step. Lives until manually deleted.
50
+
*/
51
+
privatestatic$sqlite_cache_dir;
52
+
48
53
/**
49
54
* The directory that the WP-CLI cache (WP_CLI_CACHE_DIR, normally "$HOME/.wp-cli/cache") is set to on a "Given an empty cache" step.
50
55
* Variable SUITE_CACHE_DIR. Lives until the end of the scenario (or until another "Given an empty cache" step within the scenario).
@@ -67,6 +72,11 @@ class FeatureContext implements SnippetAcceptingContext {
67
72
'dbhost' => '127.0.0.1',
68
73
];
69
74
75
+
/**
76
+
* What type of database should WordPress use for the test installations. Default to MySQL
77
+
*/
78
+
privatestatic$db_type = 'mysql';
79
+
70
80
/**
71
81
* Array of background process ids started by the current scenario. Used to terminate them at the end of the scenario.
72
82
*/
@@ -319,14 +329,82 @@ private static function get_behat_internal_variables() {
319
329
return$variables;
320
330
}
321
331
332
+
/**
333
+
* Download and extract a single copy of the sqlite-database-integration plugin
0 commit comments