Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

SSR: Add wp-context, wp-bind, wp-class, wp-style #133

Merged
merged 30 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
e1df56c
Add PHPUnit files from Gutenberg
ockham Dec 19, 2022
bd20d4b
Install phpunit and phpunit-polyfills
ockham Dec 22, 2022
e337c16
Upgrade wordpress/env to 5.8.0
ockham Dec 22, 2022
e91f70a
Comment out some stuff in PHPUnit bootstrap
ockham Dec 19, 2022
e12112f
Add mappings to .wp-env.json
ockham Dec 19, 2022
509ef2f
Add test:unit:php script
ockham Dec 22, 2022
11920b2
More permissive unit test names
ockham Dec 19, 2022
72c65f0
Add unit-test.yml workflow from Gutenberg
ockham Dec 19, 2022
ecf4db7
Trim down unit test workflow
ockham Dec 19, 2022
35015c0
Workflow: Install composer dependencies
ockham Dec 19, 2022
f396d34
Add context and bind directives plus test coverage
ockham Jan 19, 2023
ae2cfda
Move WP_Directive_Context to dedicated file
ockham Jan 19, 2023
71e3d25
Add class and style directives
ockham Jan 19, 2023
8e2248d
Add PHPDoc for WP_Directive_Context
ockham Jan 19, 2023
6ae157d
Format PHP
ockham Jan 19, 2023
0fcbb1a
Add more PHPDoc to WP_Directive_Context
ockham Jan 19, 2023
2981818
Nicer code
ockham Jan 19, 2023
5165b15
wp-bind: Add test to check that empty bound attributes are ignored
ockham Jan 19, 2023
0d396fc
wp-class: Add test to check that empty classnames are ignored
ockham Jan 19, 2023
ba42e0a
wp-style: Add test to check that empty styles are ignored
ockham Jan 19, 2023
15f45f1
Add comment
ockham Jan 19, 2023
ba78940
Rename wp-bind directive test
ockham Jan 19, 2023
6c2c6ed
Ignore wp-bind, wp-class, and wp-style *tags*
ockham Jan 19, 2023
9d4fcb9
Format PHP
ockham Jan 19, 2023
b63df86
Add more granular unit tests for wp-context
ockham Jan 19, 2023
8acf0aa
Remove messy wp-context unit test
ockham Jan 19, 2023
a1d8978
Add coverage for wp-context attribute
ockham Jan 19, 2023
6ee91c1
Formatting
ockham Jan 19, 2023
55f7861
Add basic directives processing loop
ockham Jan 19, 2023
2b98a8a
Even more PHPDoc for WP_Directive_Context
ockham Jan 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Unit Tests

on:
pull_request:
push:
branches:
- 'main*'

# Cancels all previous workflow runs for pull requests that have not completed.
concurrency:
# The concurrency group contains the workflow name and the branch name for pull requests
# or the commit hash for any other events.
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true

jobs:
unit-php:
name: PHP
runs-on: ubuntu-latest
if: ${{ github.repository == 'WordPress/block-hydration-experiments' || github.event_name == 'pull_request' }}

steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Install Composer dependencies
run: |
composer install

- name: Use desired version of NodeJS
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version: 14
cache: npm

- name: Npm install and build
run: |
npm ci
npm run build

- name: Run WordPress
run: |
npm run wp-env start

- name: Running single site unit tests
run: npm run test:unit:php
if: ${{ success() || failure() }}
7 changes: 7 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,12 @@
],
"config": {
"SCRIPT_DEBUG": true
},
"env": {
"tests": {
"mappings": {
"wp-content/plugins/block-hydration-experiments": "."
}
}
}
}
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@
"squizlabs/php_codesniffer": "^3.5",
"phpcompatibility/phpcompatibility-wp": "^2.1.3",
"wp-coding-standards/wpcs": "^2.2",
"sirbrillig/phpcs-variable-analysis": "^2.8"
"sirbrillig/phpcs-variable-analysis": "^2.8",
"phpunit/phpunit": "^9.5",
"yoast/phpunit-polyfills": "^1.0"
},
"require": {
"composer/installers": "~1.0"
Expand Down
Loading