Skip to content

Commit 894bb86

Browse files
authored
Workflows
1 parent 951ea78 commit 894bb86

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.github/workflows/phpunit.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ jobs:
7777
dependency-versions: highest
7878
composer-options: "--prefer-dist --no-suggest --no-progress"
7979

80+
- name: Prepare Database
81+
run: |
82+
# Drop the database if it exists to avoid creation error
83+
mysql -u root --password=root --host=127.0.0.1 --port=3306 -e "DROP DATABASE IF EXISTS wordpress_test;"
84+
8085
- name: Setup WP Tests
8186
run: |
8287
bash bin/install-wp-tests.sh wordpress_test root root 127.0.0.1:3306 ${{ matrix.wp-version }}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Enabled automatic PR creation for WordPress compatibility updates with "automated" and "documentation" labels
1313
- Added PHPUnit test framework with GitHub Actions workflow for automated testing
1414
- Configured cross-version PHP testing (7.4-8.2) with multisite support
15+
- Fixed database creation issues in testing workflow for CI environment
1516

1617
## [1.5.4] - 2025-05-04
1718
### Changed

tests/bin/install-wp-tests.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ install_test_suite() {
108108
}
109109

110110
install_db() {
111-
112111
if [ ${SKIP_DB_CREATE} = "true" ]; then
113112
return 0
114113
fi
@@ -129,6 +128,9 @@ install_db() {
129128
fi
130129
fi
131130

131+
# Drop database if it exists
132+
mysql --user="$DB_USER" --password="$DB_PASS"$EXTRA -e "DROP DATABASE IF EXISTS $DB_NAME"
133+
132134
# create database
133135
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA
134136
}

0 commit comments

Comments
 (0)