Skip to content

Commit a692188

Browse files
Task/update phpunit 9.6 (#46)
* Update phpunit 9.6 * Replace setExpectedException with expectException * Replace PHPUnit_Framework_TestCase with \PHPUnit\Framework\TestCase * Autoformat when updating composer * Resolve rounding issue * Defining dynamic properties is deprecated * Define return types for stream wrapper * Return valid string, dirname null is not allowed * Downgrade lock file for 7.4 * Run workflows on every branch * Split setup and run integration tests * Split mocks and test * Replace mocks by wordpress * Exit if failed * Force install * Remove insecure flag * install offload only on 55 or higher
1 parent 36f8f13 commit a692188

26 files changed

Lines changed: 1265 additions & 684 deletions

.github/workflows/check-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Check and Test
33
on:
44
push:
55
branches:
6-
- 'master'
6+
- '**'
77
pull_request:
88
branches:
99
- '**'

.github/workflows/integration-tests.yml

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Integration Tests
33
on:
44
push:
55
branches:
6-
- 'master'
6+
- '**'
77
pull_request:
88
branches:
99
- '**'
@@ -31,7 +31,7 @@ jobs:
3131
with:
3232
node-version: 18
3333
cache: 'npm'
34-
34+
3535
- name: Cache node_modules
3636
uses: actions/cache@v4
3737
with:
@@ -57,13 +57,26 @@ jobs:
5757

5858
- run: npx playwright install --with-deps
5959
if: steps.playwright-cache.outputs.cache-hit != 'true'
60-
61-
- name: Run script
62-
run: ./bin/integration-tests ${{ matrix.wp }} ${{ matrix.php}}
60+
61+
- name: Start WordPress
62+
uses: nick-fields/retry@v3
63+
with:
64+
timeout_minutes: 10
65+
max_attempts: 3
66+
shell: bash
67+
command: ./bin/run-wordpress ${{ matrix.wp }} ${{ matrix.php}}
68+
69+
- name: Start Mocks
70+
run: ./bin/run-mocks 8100
71+
72+
- name: Run integration tests
73+
run: npm run test:playwright
74+
env:
75+
WORDPRESS_PORT: 80${{ matrix.wp }}
6376

6477
- uses: actions/upload-artifact@v4
6578
if: ${{ !cancelled() }}
6679
with:
6780
name: playwright-report-${{ matrix.wp }}-${{ matrix.php }}
6881
path: playwright-report/
69-
retention-days: 30
82+
retention-days: 30

bin/integration-tests

Lines changed: 0 additions & 100 deletions
This file was deleted.

bin/run-wordpress

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ export WP_ENV_TESTS_PORT=80${WORDPRESS_VERSION}
3232
export WP_ENV_CORE=WordPress/Wordpress#${WORDPRESS_VERSION_FULL}
3333
export WP_ENV_PHP_VERSION=${PHP_VERSION_FULL}
3434

35-
npx wp-env start
35+
npx wp-env start || exit 1
3636

3737
echo "Installing compatible plugins.."
38-
npx wp-env run tests-cli wp plugin install amazon-s3-and-cloudfront
38+
39+
if [ "$WORDPRESS_VERSION" -ge 55 ]; then
40+
echo "Installing compatible plugins for WordPress ${WORDPRESS_VERSION_FULL}.."
41+
npx wp-env run tests-cli wp plugin install amazon-s3-and-cloudfront || exit 1
42+
fi
3943

4044
echo "To stop, run: bin/stop-wordpress"

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"composer/installers": "~1.0"
1818
},
1919
"require-dev": {
20-
"phpunit/phpunit": "~4.6",
20+
"phpunit/phpunit": "9.6.22",
2121
"mikey179/vfsstream": "~1.5",
2222
"mockery/mockery": "~0.9",
2323
"phpdocumentor/reflection-docblock": "~2.0",

0 commit comments

Comments
 (0)