Skip to content

Commit

Permalink
Merge branch 'develop' into feature/original-user-language-output
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbillion committed Feb 28, 2024
2 parents d58e8c1 + 6afd142 commit 5ea747b
Show file tree
Hide file tree
Showing 28 changed files with 356 additions and 269 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@
/package.json export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
/readme.md export-ignore
/SECURITY.md export-ignore
42 changes: 20 additions & 22 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,25 @@ on:
branches:
- 'develop'
- 'trunk'
- 'master'
paths:
- '.github/workflows/acceptance-tests.yml'
- 'tests/**'
- '**.php'
- 'codeception.dist.yml'
- 'composer.json'
- 'docker-compose.yml'
- 'package.json'
pull_request:
branches:
- '**'
schedule:
# Once weekly on Mondays at 04:00 UTC.
#
# ┌───────────── minute (0 - 59)
# │ ┌────────── hour (0 - 23)
# │ │ ┌─────── day of the month (1 - 31)
# │ │ │ ┌──── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌─ day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: '0 4 * * 1'
paths:
- '.github/workflows/acceptance-tests.yml'
- 'tests/**'
- '**.php'
- 'codeception.dist.yml'
- 'composer.json'
- 'docker-compose.yml'
- 'package.json'
workflow_dispatch:

jobs:
Expand All @@ -30,19 +33,14 @@ jobs:
strategy:
matrix:
wp:
- 'nightly'
- '6.4'
- '6.3'
- '6.2'
php:
- '8.2'
- '7.4'
- '7.2'
dev:
- ${{ github.ref_name == 'develop' }}
exclude:
# Only run the nightly tests on the develop branch.
- wp: 'nightly'
dev: false
include:
- wp: '6.4'
php: '8.3'
fail-fast: false
uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-acceptance-tests.yml@trunk
with:
Expand Down
27 changes: 14 additions & 13 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@ on:
branches:
- 'develop'
- 'trunk'
- 'master'
paths:
- '.github/workflows/coding-standards.yml'
- '**.php'
- 'composer.json'
- 'package.json'
- 'phpcs.xml.dist'
- 'phpstan.neon.dist'
pull_request:
branches:
- '**'
schedule:
# Once weekly on Mondays at 03:00 UTC.
#
# ┌───────────── minute (0 - 59)
# │ ┌────────── hour (0 - 23)
# │ │ ┌─────── day of the month (1 - 31)
# │ │ │ ┌──── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌─ day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: '0 3 * * 1'
paths:
- '.github/workflows/coding-standards.yml'
- '**.php'
- 'composer.json'
- 'package.json'
- 'phpcs.xml.dist'
- 'phpstan.neon.dist'
workflow_dispatch:

jobs:
Expand Down
42 changes: 20 additions & 22 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,25 @@ on:
branches:
- 'develop'
- 'trunk'
- 'master'
paths:
- '.github/workflows/integration-tests.yml'
- 'tests/**'
- '**.php'
- 'codeception.dist.yml'
- 'composer.json'
- 'docker-compose.yml'
- 'package.json'
pull_request:
branches:
- '**'
schedule:
# Once weekly on Mondays at 05:00 UTC.
#
# ┌───────────── minute (0 - 59)
# │ ┌────────── hour (0 - 23)
# │ │ ┌─────── day of the month (1 - 31)
# │ │ │ ┌──── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌─ day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: '0 5 * * 1'
paths:
- '.github/workflows/integration-tests.yml'
- 'tests/**'
- '**.php'
- 'codeception.dist.yml'
- 'composer.json'
- 'docker-compose.yml'
- 'package.json'
workflow_dispatch:

jobs:
Expand All @@ -31,19 +34,14 @@ jobs:
strategy:
matrix:
wp:
- 'nightly'
- '6.4'
- '6.3'
- '6.2'
- '6.1'
php:
- '8.2'
- '7.4'
dev:
- ${{ github.ref_name == 'develop' }}
exclude:
# Only run the nightly tests on the develop branch.
- wp: 'nightly'
dev: false
include:
- wp: '6.4'
php: '8.3'
fail-fast: false
with:
wp: ${{ matrix.wp }}
Expand Down
50 changes: 50 additions & 0 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow

name: Nightly Tests
on:
schedule:
# Once weekly on Mondays at 04:00 UTC.
#
# ┌───────────── minute (0 - 59)
# │ ┌────────── hour (0 - 23)
# │ │ ┌─────── day of the month (1 - 31)
# │ │ │ ┌──── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌─ day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
- cron: '0 4 * * 1'
push:
branches:
- 'develop'
paths:
- '.github/workflows/nightly-tests.yml'
workflow_dispatch:

jobs:
acceptance:
name: Nightly acceptance / PHP ${{ matrix.php }}
strategy:
matrix:
php:
- '8.3'
- '7.4'
fail-fast: false
uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-acceptance-tests.yml@trunk
with:
wp: 'nightly'
php: ${{ matrix.php }}
node: false
integration:
name: Nightly integration / PHP ${{ matrix.php }}
uses: johnbillion/plugin-infrastructure/.github/workflows/reusable-integration-tests.yml@trunk
strategy:
matrix:
php:
- '8.3'
- '7.4'
fail-fast: false
with:
wp: 'nightly'
php: ${{ matrix.php }}
node: false
42 changes: 42 additions & 0 deletions .wordpress-org/blueprints/blueprint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$schema": "https://playground.wordpress.net/blueprint-schema.json",
"landingPage": "/wp-admin/users.php",
"steps": [
{
"step": "installPlugin",
"pluginZipFile": {
"resource": "wordpress.org/plugins",
"slug": "user-switching"
}
},
{
"step": "writeFile",
"path": "/wordpress/wp-content/mu-plugins/user-switching-helper.php",
"data":{
"resource":"url",
"url":"https://raw.githubusercontent.com/johnbillion/user-switching/trunk/.wordpress-org/blueprints/user-switching-helper.php"
}
},
{
"step": "login",
"username": "admin",
"password": "password"
},
{
"step": "wp-cli",
"command": "wp user create editor editor@example.com --role=editor"
},
{
"step": "wp-cli",
"command": "wp user create author author@example.com --role=author"
},
{
"step": "wp-cli",
"command": "wp user create contributor contributor@example.com --role=contributor"
},
{
"step": "wp-cli",
"command": "wp user create subscriber subscriber@example.com --role=subscriber"
}
]
}
13 changes: 13 additions & 0 deletions .wordpress-org/blueprints/user-switching-helper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
/**
* Plugin Name: User Switching Playground Helper
* Description: A helper plugin for running User Switching in the WordPress playground
*/

add_filter(
'user_row_actions',
function ( array $actions ) {
unset( $actions['resetpassword'] );
return $actions;
}
);
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ representative at an online or offline event.

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
john@johnblackbourn.com.
https://johnblackbourn.com/about/ .
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
Expand Down
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[![Build Status](https://img.shields.io/github/workflow/status/johnbillion/user-switching/Test/develop?style=flat-square)](https://github.com/johnbillion/user-switching/actions)
[![](https://img.shields.io/badge/contributor-code%20of%20conduct-5e0d73.svg?style=flat-square)](https://github.com/johnbillion/user-switching/blob/develop/CODE_OF_CONDUCT.md)
[![](https://img.shields.io/badge/ethical-open%20source-4baaaa.svg?style=flat-square)](#ethical-open-source)

Expand Down Expand Up @@ -37,7 +36,7 @@ Install the PHP dependencies:

## Running the Tests

The test suite includes acceptance tests which run in a Docker container. Ensure Docker Desktop is running, then start the containers with:
The test suite includes integration and acceptance tests which run in a Docker container. Ensure Docker Desktop is running, then start the containers with:

composer test:start

Expand Down
33 changes: 15 additions & 18 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,23 @@
}
],
"require": {
"php": ">=7.2",
"php": ">=7.4",
"composer/installers": "^1.0 || ^2.0"
},
"require-dev": {
"codeception/module-asserts": "^1.0",
"codeception/module-db": "^1.0",
"codeception/module-webdriver": "^1.0",
"codeception/util-universalframework": "^1.0",
"dealerdirect/phpcodesniffer-composer-installer": "0.7.2",
"ergebnis/composer-normalize": "^2",
"johnbillion/plugin-infrastructure": "dev-trunk",
"lucatume/wp-browser": "^3.0.21",
"lucatume/wp-browser": "3.2.1",
"phpcompatibility/phpcompatibility-wp": "2.1.4",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpstan/phpstan": "1.10.41",
"phpstan/phpstan-phpunit": "1.3.15",
"roots/wordpress-core-installer": "^1.0.0",
"roots/wordpress-full": "*",
"squizlabs/php_codesniffer": "3.7.1",
"szepeviktor/phpstan-wordpress": "1.3.0",
"wp-coding-standards/wpcs": "2.3.0"
"szepeviktor/phpstan-wordpress": "1.3.2",
"wp-coding-standards/wpcs": "3.0.1"
},
"autoload-dev": {
"psr-4": {
Expand All @@ -50,10 +47,9 @@
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"ergebnis/composer-normalize": true,
"composer/installers": true,
"roots/wordpress-core-installer": true,
"composer/installers": true
"dealerdirect/phpcodesniffer-composer-installer": true
},
"classmap-authoritative": true,
"preferred-install": "dist",
Expand All @@ -66,33 +62,34 @@
"scripts": {
"test": [
"@composer validate --strict --no-check-lock",
"@composer normalize --dry-run",
"@test:phpstan",
"@test:phpcs",
"@test:start",
"@test:integration",
"@test:acceptance"
"@test:acceptance",
"@test:stop"
],
"test:acceptance": [
"acceptance-tests --cli=\"language core install it_IT\" --cli=\"language plugin install user-switching it_IT\""
],
"test:destroy": [
"COMPOSE_PROJECT_NAME=user-switching docker compose down --volumes --remove-orphans"
"tests-destroy"
],
"test:integration": [
"integration-tests"
],
"test:phpcs": [
"phpcs -nps --colors --report-code --report-summary --report-width=80 --cache=tests/cache/phpcs.json --basepath='./' ."
"phpcs -ps --colors --report-code --report-summary --report-width=80 --basepath='./' ."
],
"test:phpstan": [
"codecept build",
"phpstan analyze --memory-limit=1024M"
],
"test:start": [
"COMPOSE_PROJECT_NAME=user-switching docker compose up -d"
"tests-start"
],
"test:stop": [
"COMPOSE_PROJECT_NAME=user-switching docker compose down"
"tests-stop"
]
}
}
Loading

0 comments on commit 5ea747b

Please sign in to comment.