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

Experiment with WP_HTML_Tag_Processor #118

Closed
wants to merge 54 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
0f3426c
Remove ssr.mjs
ockham Dec 13, 2022
2618b45
Remove now-obsolete SSR helpers
ockham Dec 13, 2022
d246f70
Copy WP_HTML_Tag_Processor code from Gutenberg
ockham Dec 13, 2022
ac78938
Use more complex code for Tabs block
ockham Dec 13, 2022
4c41dd0
Add basic Tag Processor based logic
ockham Dec 13, 2022
1933d53
Abstract directive processors
ockham Dec 13, 2022
0e3722c
Components can't have directives
ockham Dec 13, 2022
f333a1f
Remove debug output
ockham Dec 13, 2022
3d3fa5b
Change order a bit
ockham Dec 13, 2022
e5f052f
Use array_replace_recursive instead of array_merge_recursive
ockham Dec 14, 2022
6a4a9c5
Support more per-directive data
ockham Dec 14, 2022
d6ca85b
Fix wp-context as a component
ockham Dec 14, 2022
7701c23
Unify attribute/content handling
ockham Dec 14, 2022
6dd686b
Update HTML (Tag) Processor from gb#46345
ockham Dec 14, 2022
81e866d
Add HTML Processor to index.php
ockham Dec 14, 2022
5a26936
Have wp-show directive processor return template-wrapped content
ockham Dec 14, 2022
27f129c
Update WP_HTML_Processor from gb#46345
ockham Dec 15, 2022
14fc264
Remove currently unneeded WP_HTML_Attribute_Sourcer
ockham Dec 15, 2022
4cef805
Remove now-obsolete code
ockham Dec 15, 2022
faae6d8
Add PHPUnit files from Gutenberg
ockham Dec 19, 2022
5bdf348
Install phpunit and polyfills
ockham Dec 19, 2022
548f8fe
Upgrade wordpress/env package
ockham Dec 19, 2022
1c167e9
Comment out some stuff in PHPUnit bootstrap
ockham Dec 19, 2022
493f7ce
Add mappings to .wp-env.json
ockham Dec 19, 2022
cc58408
Add test:unit:php script
ockham Dec 19, 2022
2b90183
Move directives code into separate files
ockham Dec 19, 2022
0dd2f20
More permissive unit test names
ockham Dec 19, 2022
051d290
Add basic unit test for wp-context
ockham Dec 19, 2022
f8dd300
Slightly more sophisticated test
ockham Dec 19, 2022
bf4d7f6
Minor cleanup
ockham Dec 19, 2022
f968773
Add basic test coverage for wp-show
ockham Dec 19, 2022
c084f4a
wp-show: Assert context is unmodified
ockham Dec 19, 2022
e866958
Add unit-test.yml workflow from Gutenberg
ockham Dec 19, 2022
0a474b9
Trim down unit test workflow
ockham Dec 19, 2022
556dc14
Workflow: Install composer dependencies
ockham Dec 19, 2022
1f6572f
Add get_attributes_by_prefix() method
ockham Dec 20, 2022
7073116
Pass directive name, retrieve all matching directives
ockham Dec 20, 2022
07ff956
Change argument order
ockham Dec 20, 2022
d3497ea
Typo
ockham Dec 20, 2022
8334591
Make WP_HTML_Tag_Processor the interface
ockham Dec 20, 2022
e4228c1
Extract expression parser
ockham Dec 20, 2022
751027c
Add basic wp-bind code
ockham Dec 20, 2022
70d85d1
Added link to bugfix PR
ockham Dec 20, 2022
2a38762
Fix bug in wp-directives
ockham Dec 21, 2022
685ac76
Make wp-context more error-tolerant
ockham Dec 21, 2022
21d598a
Implement basic context stacking
ockham Dec 21, 2022
6f45299
Introduce WP_Directive_Context helper class
ockham Dec 21, 2022
cc402da
Use in other directive processors
ockham Dec 21, 2022
4f1e83d
Update directives processing logic to use context object
ockham Dec 21, 2022
b2e7ccc
A bit more test coverage still
ockham Dec 21, 2022
fb11797
Short-circuit
ockham Dec 21, 2022
4ff88d5
Organize code slightly differently
ockham Dec 21, 2022
68d6100
Add TODO comment
ockham Dec 21, 2022
d6195c4
Include closing tags
ockham Dec 22, 2022
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() }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
node_modules
build
build
.phpunit.result.cache
composer.lock
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": "."
}
}
}
}
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"require-dev": {
"phpunit/phpunit": "^9.5",
"yoast/phpunit-polyfills": "^1.0"
}
}
Loading