Skip to content

Commit 42bc27b

Browse files
authored
Merge pull request #279 from wp-cli/fix/gha-functional-tests-update
2 parents c286761 + 013a52a commit 42bc27b

File tree

4 files changed

+65
-30
lines changed

4 files changed

+65
-30
lines changed

.github/workflows/testing.yml

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
13-
runs-on: ubuntu-latest
13+
runs-on: ubuntu-20.04
1414

1515
steps:
1616
- name: Check out source code
@@ -58,35 +58,55 @@ jobs:
5858
run: composer phpunit
5959

6060
functional: #----------------------------------------------------------------------
61-
name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }}
61+
name: Functional - WP ${{ matrix.wp }} on PHP ${{ matrix.php }} with MySQL ${{ matrix.mysql }}
6262
strategy:
6363
fail-fast: false
6464
matrix:
65-
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
65+
php: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0']
6666
wp: ['latest']
67+
mysql: ['8.0']
6768
test: ["composer behat || composer behat-rerun"]
6869
include:
6970
- php: '5.6'
7071
wp: 'trunk'
72+
mysql: '8.0'
73+
test: "composer behat || composer behat-rerun"
74+
- php: '5.6'
75+
wp: 'trunk'
76+
mysql: '5.7'
77+
test: "composer behat || composer behat-rerun"
78+
- php: '5.6'
79+
wp: 'trunk'
80+
mysql: '5.6'
7181
test: "composer behat || composer behat-rerun"
7282
- php: '7.4'
7383
wp: 'trunk'
84+
mysql: '8.0'
85+
test: "composer behat || composer behat-rerun"
86+
- php: '8.0'
87+
wp: 'trunk'
88+
mysql: '8.0'
89+
test: "composer behat || composer behat-rerun"
90+
- php: '8.0'
91+
wp: 'trunk'
92+
mysql: '5.7'
93+
test: "composer behat || composer behat-rerun"
94+
- php: '8.0'
95+
wp: 'trunk'
96+
mysql: '5.6'
7497
test: "composer behat || composer behat-rerun"
7598
- php: '5.6'
7699
wp: '3.7'
77-
test: "composer behat || composer behat-rerun || true"
78-
runs-on: ubuntu-latest
100+
mysql: '5.6'
101+
test: "composer behat || composer behat-rerun"
102+
runs-on: ubuntu-20.04
79103

80104
services:
81105
mysql:
82-
image: mysql:5.7
83-
env:
84-
MYSQL_DATABASE: wp_cli_test
85-
MYSQL_USER: root
86-
MYSQL_ROOT_PASSWORD: root
106+
image: mysql:${{ matrix.mysql }}
87107
ports:
88108
- 3306
89-
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
109+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 -e MYSQL_ROOT_PASSWORD=root -e MYSQL_DATABASE=wp_cli_test --entrypoint sh mysql:${{ matrix.mysql }} -c "exec docker-entrypoint.sh mysqld --default-authentication-plugin=mysql_native_password"
90110

91111
steps:
92112
- name: Check out source code
@@ -99,6 +119,7 @@ jobs:
99119
files: "composer.json, behat.yml"
100120

101121
- name: Set up PHP envirnoment
122+
if: steps.check_files.outputs.files_exists == 'true'
102123
uses: shivammathur/setup-php@v2
103124
with:
104125
php-version: '${{ matrix.php }}'
@@ -127,20 +148,25 @@ jobs:
127148

128149
- name: Start MySQL server
129150
if: steps.check_files.outputs.files_exists == 'true'
130-
run: sudo service mysql start
151+
run: sudo systemctl start mysql
131152

132-
- name: Prepare test database
153+
- name: Configure DB environment
133154
if: steps.check_files.outputs.files_exists == 'true'
134155
run: |
135-
export MYQSL_HOST=127.0.0.1
156+
export MYSQL_HOST=127.0.0.1
136157
export MYSQL_TCP_PORT=${{ job.services.mysql.ports['3306'] }}
137-
mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot -proot
138-
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "password1"' -uroot -proot
139-
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"127.0.0.1" IDENTIFIED BY "password1"' -uroot -proot
158+
echo "WP_CLI_TEST_DBROOTUSER=root" >> $GITHUB_ENV
159+
echo "WP_CLI_TEST_DBROOTPASS=root" >> $GITHUB_ENV
160+
echo "WP_CLI_TEST_DBUSER=wp_cli_test" >> $GITHUB_ENV
161+
echo "WP_CLI_TEST_DBPASS=password1" >> $GITHUB_ENV
162+
echo "WP_CLI_TEST_DBHOST=$MYSQL_HOST:$MYSQL_TCP_PORT" >> $GITHUB_ENV
163+
164+
- name: Prepare test database
165+
if: steps.check_files.outputs.files_exists == 'true'
166+
run: composer prepare-tests
140167

141168
- name: Run Behat
142169
if: steps.check_files.outputs.files_exists == 'true'
143170
env:
144171
WP_VERSION: '${{ matrix.wp }}'
145172
run: ${{ matrix.test }}
146-

behat.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
default:
2-
paths:
3-
features: features
4-
bootstrap: vendor/wp-cli/wp-cli-tests/features/bootstrap
2+
suites:
3+
default:
4+
contexts:
5+
- WP_CLI\Tests\Context\FeatureContext
6+
paths:
7+
- features

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818
],
1919
"require": {
2020
"composer/semver": "^1.4 || ^2 || ^3",
21-
"wp-cli/wp-cli": "dev-master"
21+
"wp-cli/wp-cli": "^2.5",
22+
"wp-cli/wp-cli-tests": "^3.0.7"
2223
},
2324
"require-dev": {
2425
"wp-cli/entity-command": "^1.3 || ^2",
25-
"wp-cli/scaffold-command": "^1.2 || ^2",
26-
"wp-cli/wp-cli-tests": "^2.1.6"
26+
"wp-cli/scaffold-command": "^1.2 || ^2"
2727
},
2828
"config": {
2929
"process-timeout": 7200,

features/theme.feature

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -270,31 +270,36 @@ Feature: Manage WordPress themes
270270
Success: Switched to 'Buntu' theme.
271271
"""
272272
273-
When I run `wp network-meta get 1 allowedthemes`
273+
# Hybrid_Registry throws warning for PHP 8+.
274+
When I try `wp network-meta get 1 allowedthemes`
274275
Then STDOUT should not contain:
275276
"""
276277
'buntu' => true
277278
"""
278279
279-
When I run `wp theme enable buntu --network`
280+
# Hybrid_Registry throws warning for PHP 8+.
281+
When I try `wp theme enable buntu --network`
280282
Then STDOUT should contain:
281283
"""
282284
Success: Network enabled the 'Buntu' theme.
283285
"""
284286
285-
When I run `wp network-meta get 1 allowedthemes`
287+
# Hybrid_Registry throws warning for PHP 8+.
288+
When I try `wp network-meta get 1 allowedthemes`
286289
Then STDOUT should contain:
287290
"""
288291
'buntu' => true
289292
"""
290293
291-
When I run `wp theme disable buntu --network`
294+
# Hybrid_Registry throws warning for PHP 8+.
295+
When I try `wp theme disable buntu --network`
292296
Then STDOUT should contain:
293297
"""
294298
Success: Network disabled the 'Buntu' theme.
295299
"""
296300
297-
When I run `wp network-meta get 1 allowedthemes`
301+
# Hybrid_Registry throws warning for PHP 8+.
302+
When I try `wp network-meta get 1 allowedthemes`
298303
Then STDOUT should not contain:
299304
"""
300305
'buntu' => true
@@ -351,7 +356,8 @@ Feature: Manage WordPress themes
351356
And I run `wp theme install stargazer`
352357
And I run `wp theme install --activate buntu`
353358
354-
When I run `wp theme list --fields=name,status`
359+
# Hybrid_Registry throws warning for PHP 8+.
360+
When I try `wp theme list --fields=name,status`
355361
Then STDOUT should be a table containing rows:
356362
| name | status |
357363
| buntu | active |

0 commit comments

Comments
 (0)