Skip to content

Commit

Permalink
Adjust SQLite in configuration script to disable the database creation (
Browse files Browse the repository at this point in the history
#321)

* Testing the sqlite changes in alleyinteractive/mantle-ci#20

* Make it empty

* WP_SKIP_DB_CREATE

* Reverting changs

* Fix function name

* Fixing search and replace
  • Loading branch information
srtfisher authored Feb 22, 2024
1 parent a4b4d26 commit 5c899e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 10 additions & 4 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,14 @@ function enable_sqlite_testing(): void {
file_put_contents(
__DIR__ . '/phpunit.xml',
str_replace(
'<!-- <env name="MANTLE_USE_SQLITE" value="true" /> -->',
'<env name="MANTLE_USE_SQLITE" value="true" />',
[
'<!-- <env name="MANTLE_USE_SQLITE" value="true" /> -->',
'<!-- <env name="WP_SKIP_DB_CREATE" value="true" /> -->',
],
[
'<env name="MANTLE_USE_SQLITE" value="true" />',
'<env name="WP_SKIP_DB_CREATE" value="true" />',
],
(string) file_get_contents( __DIR__ . '/phpunit.xml' ),
),
);
Expand All @@ -369,7 +375,7 @@ function enable_sqlite_testing(): void {
__DIR__ . '/.github/workflows/unit-test.yml',
str_replace(
'with:',
"with:\n database: 'false'",
"with:\n database: ''",
(string) file_get_contents( __DIR__ . '/.github/workflows/unit-test.yml' ),
),
);
Expand Down Expand Up @@ -747,7 +753,7 @@ function enable_sqlite_testing(): void {
}
}

if ( $standalone && confirm( 'Do you want to use SQLite for unit testing?', true ) ) {
if ( $standalone && confirm( 'Do you want to use SQLite for unit testing? (This is a great way to speed up your tests!)', true ) ) {
enable_sqlite_testing();
}

Expand Down
3 changes: 2 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
</testsuite>
</testsuites>
<php>
<!-- <env name="MANTLE_USE_SQLITE" value="true" /> -->
<!-- <env name="MANTLE_USE_SQLITE" value="true" /> -->
<!-- <env name="WP_SKIP_DB_CREATE" value="true" /> -->
</php>
</phpunit>

0 comments on commit 5c899e2

Please sign in to comment.