-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PHPUnit tests for mu-plugins #204
Open
dd32
wants to merge
26
commits into
WordPress:trunk
Choose a base branch
from
dd32:try/cdn-tests
base: trunk
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0ab1c75
Add a CDNise mu-plugin.
dd32 68d17c7
Fix whitespace.
dd32 f198491
Use `parse_str()` instead of `preg_match()`.
dd32 12f0349
Remove the blocked handles, as the production CDN now serves appropri…
dd32 51fd6af
Load the CDN plugin.
dd32 1659734
Reformat coding style.
dd32 eb981f3
Change the resource matching to be based on domain, rather than subst…
dd32 43f6929
Switch to stripping the hostname / sub-site off rather than explicit …
dd32 7482031
Add PHPUnit bootstrapping
dd32 cd84e89
Install deps correctly.
dd32 dfd4901
Fix composer deps
dd32 90880be
Setup wp-env too
dd32 a1663b7
Fix typo in loader
dd32 63e1570
Merge branch 'add/cdn-plugin' into try/cdn-tests
dd32 8881d87
Update to gutenberg bootstrap
dd32 02c87a1
Add phpunit deps
dd32 631d34e
Set the WP_RUN_CORE_TESTS constant so that we can test the wp_environ…
dd32 bd11c69
Add tests for the CDN plugin
dd32 f9d18c2
Force phpunits config file not to be forced to local environment, to …
dd32 06519d4
Add more unit tests
dd32 9897577
Attempt to work around phpunit-wp-config.php permissions
dd32 e3ba1d5
Revert "Attempt to work around phpunit-wp-config.php permissions"
dd32 6b4cc86
Attempt to workaround wp-env permissions and limitations.
dd32 47a2afc
Simplify the phpunit bootstrapping
dd32 3a81eff
Move @wordpress/env to a devDep
dd32 f925a31
Revert composer/installers change.
dd32 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ trunk, add/cdn-plugin, try/cdn-tests ] | ||
pull_request: | ||
branches: [ trunk ] | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
run-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm install | ||
composer install | ||
npm run wp-env start | ||
npm run build | ||
|
||
- name: Run PHP unit tests | ||
run: | | ||
# Delete the default wp-env forced environment type | ||
sed "/WP_ENVIRONMENT_TYPE/d" -i `npm run wp-env install-path 2>/dev/null | tail -n1`/tests-WordPress/phpunit-wp-config.php | ||
npm run test:php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"core": "WordPress/WordPress#master", | ||
"mappings": { | ||
"wp-content/mu-plugins": "./mu-plugins" | ||
}, | ||
"env": { | ||
"tests": { | ||
"mappings": { | ||
"vendor": "./vendor", | ||
"phpunit": "./phpunit", | ||
"phpunit.xml.dist": "./phpunit.xml.dist" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure if this is actually needed here, I suspect it's not, as it would only be needed if you're running
phpunit
outside ofwp-env
.The below wp-phpunit & yoast deps are however required.