Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
b4ec45b
fix: correct PHP notice on register-rest-route in WordPress v5.5.0
rkaiser0324 Jan 20, 2021
2892219
Merge pull request #96 from rkaiser0324/fix/register-rest-route
Nov 17, 2021
b0d9efb
Update PR template
bxsx Nov 29, 2021
123a54e
Merge pull request #103 from rollbar/bxsx/pull-request-template
bxsx Nov 29, 2021
5064175
New release with update to tested WP versions
danielmorell Apr 18, 2022
6c33742
Merge pull request #105 from rollbar/tested_version
danielmorell Apr 18, 2022
7477cd2
Fixed #85 use existing session and admin_notices
danielmorell May 18, 2022
ab65af0
Removed unused AceEditor assets from enqueue
danielmorell May 18, 2022
304e025
Also use the WP_ENV constant
Brugman Jun 5, 2022
e87ed3d
Display skipped test as success
Brugman Jun 5, 2022
c8607fe
Add settings link
Brugman Jun 5, 2022
c3d7f6b
Merge pull request #110 from Brugman/feature/skip-is-good
danielmorell Jun 6, 2022
802678f
Update syntax
Brugman Jun 7, 2022
79ec506
Update function name
Brugman Jun 7, 2022
7f23189
Deduplicate getEnvironment()
Brugman Jun 7, 2022
4837aa9
Merge pull request #111 from rollbar/fixed_85
danielmorell Jun 7, 2022
1d592cc
Merge pull request #108 from Brugman/feature/also-use-constant
danielmorell Jun 7, 2022
330eb4c
Merge pull request #109 from Brugman/feature/add-settings-link
danielmorell Jun 7, 2022
f4b40de
Bumped version to v2.6.4 and updated changelog
danielmorell Jun 13, 2022
0b547c3
Merge pull request #112 from rollbar/next/2.6.4
danielmorell Jun 21, 2022
47e83a6
ignore node_modules
aaronjorbin Jul 6, 2023
16f22b0
Change dependencies for development
aaronjorbin Jul 6, 2023
7a71157
Add wp-env for testing and development
aaronjorbin Jul 6, 2023
04b915b
Make tests compatable with yoast pollyfill
aaronjorbin Jul 6, 2023
d488471
Remove vendor files from git
aaronjorbin Jul 6, 2023
faf2892
Ensure composer has been run for the plugin
aaronjorbin Jul 6, 2023
24a9241
restore production dependencies
aaronjorbin Jul 6, 2023
4ea2621
Use version 1.9.1 of Markdown Parser
aaronjorbin Jul 6, 2023
cb183cf
Ignore PHPUNIT results cache
aaronjorbin Jul 6, 2023
81dd58b
add vendor packages
aaronjorbin Jul 6, 2023
1aeb28c
Add test instructions
aaronjorbin Jul 6, 2023
b8d06b3
First pass at phpunit action
aaronjorbin Jul 7, 2023
de44707
Push to any branch should trigger tests
aaronjorbin Jul 7, 2023
f2f4fd8
install node modules during tests
aaronjorbin Jul 7, 2023
01fe461
Use local version of wp-env
aaronjorbin Jul 7, 2023
b61d5a4
properly pass commands to wp-env
aaronjorbin Jul 7, 2023
c4a0bce
Don't activate as an MU plugin during tests
aaronjorbin Jul 7, 2023
65b5142
remove dev-dependencies again
aaronjorbin Jul 7, 2023
4f88e5e
remove PHP watcher
aaronjorbin Jul 7, 2023
100af79
Don't fail fast
aaronjorbin Jul 7, 2023
e9f8f17
Remove all dependencies
aaronjorbin Jul 7, 2023
bf7d015
Don't fail fast
aaronjorbin Jul 7, 2023
83814df
cut down on the matrix until the tests are passing
aaronjorbin Jul 7, 2023
6283099
Use snake case setups
aaronjorbin Jul 7, 2023
7b000a7
Use seperate dependecies for PHP7 and PHP8
aaronjorbin Jul 7, 2023
bcd92a1
Update plugin to work with v4 of Rollbar library
aaronjorbin Jul 10, 2023
7400a1d
Exclude non test files from tests
aaronjorbin Jul 10, 2023
d154c18
Adjust test matrix
aaronjorbin Jul 10, 2023
47ea7e1
Update documentation for test running
aaronjorbin Jul 10, 2023
f3097e9
Update path to rollbar snippit
aaronjorbin Jul 10, 2023
d552031
Merge pull request #114 from aaronjorbin/fix/unit-tests
danielmorell Jul 31, 2023
9074827
Bump semver from 5.7.1 to 5.7.2
dependabot[bot] Jul 31, 2023
d16bb99
Merge pull request #115 from rollbar/dependabot/npm_and_yarn/semver-5…
danielmorell Jul 31, 2023
6492ad0
update to 2.7.0
aaronjorbin Sep 11, 2023
4dd5278
Merge pull request #118 from aaronjorbin/master
aaronjorbin Sep 11, 2023
badf31f
Cast "1" and "0" as booleans when they are expected as booleans.
aaronjorbin Sep 13, 2023
00b403e
Merge pull request #120 from aaronjorbin/fix/119
aaronjorbin Sep 13, 2023
dc63103
Update to version 2.7.1
aaronjorbin Sep 13, 2023
48f54d3
Merge pull request #121 from rollbar/release/2.7.1
aaronjorbin Sep 13, 2023
d334124
Bump cross-spawn from 6.0.5 to 6.0.6
dependabot[bot] Nov 24, 2024
f59fe4c
Merge pull request #125 from rollbar/dependabot/npm_and_yarn/cross-sp…
danielmorell Dec 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 15 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
## Description of the change

> Description here
> Please include a summary of the change and which issues are fixed.
> Please also include relevant motivation and context.

## Type of change

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Maintenance
- [ ] New release

## Related issues

> Fix [#1]()
> Shortcut stories and GitHub issues (delete irrelevant)

- Fix [SC-]
- Fix #1

## Checklists

### Development
Expand All @@ -17,9 +26,9 @@
- [ ] The code changed/added as part of this pull request has been covered with tests
- [ ] All tests related to the changed code pass in development

### Code review
### Code review

- [ ] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
- [ ] "Ready for review" label attached to the PR and reviewers mentioned in a comment
- [ ] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
- [ ] "Ready for review" label attached to the PR and reviewers assigned
- [ ] Issue from task tracker has a link to this pull request
- [ ] Changes have been reviewed by at least one other engineer
- [ ] Issue from task tracker has a link to this pull request
123 changes: 123 additions & 0 deletions .github/workflows/php_unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: Unit Tests

# Since Unit Tests are required to pass for each PR,
# we cannot disable them for documentation-only changes.
on:
pull_request:
push:
# Allow manually triggering the workflow.
workflow_dispatch:

# 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:
compute-previous-wordpress-version:
name: Compute previous WordPress version
runs-on: ubuntu-latest
outputs:
previous-wordpress-version: ${{ steps.get-previous-wordpress-version.outputs.previous-wordpress-version }}
latest-wordpress-version: ${{ steps.get-latest-wordpress-version.outputs.latest-wordpress-version }}

steps:
- name: Get latest WordPress version
id: get-latest-wordpress-version
run: |
curl \
-H "Accept: application/json" \
-o versions.json \
"http://api.wordpress.org/core/stable-check/1.0/"
LATEST_WP_VERSION=$(jq --raw-output 'with_entries(select(.value=="latest"))|keys[]' versions.json)
echo "latest-wordpress-version=${LATEST_WP_VERSION}" >> $GITHUB_OUTPUT
rm versions.json
- name: Get previous WordPress version
id: get-previous-wordpress-version
run: |
curl \
-H "Accept: application/json" \
-o versions.json \
"http://api.wordpress.org/core/stable-check/1.0/"
LATEST_WP_VERSION=$(jq --raw-output 'with_entries(select(.value=="latest"))|keys[]' versions.json)
IFS='.' read LATEST_WP_MAJOR LATEST_WP_MINOR LATEST_WP_PATCH <<< "${LATEST_WP_VERSION}"
if [[ ${LATEST_WP_MINOR} == "0" ]]; then
PREVIOUS_WP_SERIES="$((LATEST_WP_MAJOR - 1)).9"
else
PREVIOUS_WP_SERIES="${LATEST_WP_MAJOR}.$((LATEST_WP_MINOR - 1))"
fi
PREVIOUS_WP_VERSION=$(jq --raw-output --arg series "${PREVIOUS_WP_SERIES}" 'with_entries(select(.key|startswith($series)))|keys[-1]' versions.json)
echo "previous-wordpress-version=${PREVIOUS_WP_VERSION}" >> $GITHUB_OUTPUT
rm versions.json

test-php:
name: PHP ${{ matrix.php }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest
needs: compute-previous-wordpress-version
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
php:
- '7.0'
- '7.1'
- '7.2'
- '7.3'
- '7.4'
- '8.0'
- '8.1'
- '8.2'
wordpress: ["${{needs.compute-previous-wordpress-version.outputs.latest-wordpress-version}}" ] # Latest WordPress version.
include:
# Test with the previous WP version.
- php: '7.0'
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
- php: '7.4'
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
- php: '8.2'
wordpress: ${{ needs.compute-previous-wordpress-version.outputs.previous-wordpress-version }}
# Test with the upcoming WP version.
- php: '7.0'
wordpress: ''
- php: '7.4'
wordpress: ''
- php: '8.2'
wordpress: ''

env:
WP_ENV_PHP_VERSION: ${{ matrix.php }}
WP_ENV_CORE: ${{ matrix.wordpress == '' && 'WordPress/WordPress' || format( 'https://wordpress.org/wordpress-{0}.zip', matrix.wordpress ) }}

steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- name: Install Dependencies
run: npm ci

- name: Docker debug information
run: |
docker -v
docker-compose -v

- name: General debug information
run: |
npm --version
node --version
curl --version
git --version
locale -a
echo "PHP version: ${WP_ENV_PHP_VERSION}"
echo "WordPress version: ${WP_ENV_CORE}"

- name: Start Docker environment
run: npm run wp-env start

- name: Log running Docker containers
run: docker ps -a

- name: Running unit tests
run: |
set -o pipefail
npm run test:php
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dwsync.xml
# PHPUnit
phpunit.xml
phpunit.env
.phpunit.result.cache

# PHPCS
phpcs.xml
Expand All @@ -47,4 +48,5 @@ composer.lock
intermediate
.idea
cache
deploy.sh
deploy.sh
node_modules
11 changes: 11 additions & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"core": "WordPress/WordPress",
"plugins": [ "." ],
"env": {
"tests": {
"mappings": {
"wp-content/plugins/rollbar": "."
}
}
}
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ The original author of this package is [@flowdee](https://twitter.com/flowdee/).

## Testing

The following is Mac/Linux only - Windows is not supported.
In order to run the tests, you will need to install the dependencies for [@wordpress/env](https://www.npmjs.com/package/@wordpress/env) including Node.js, git, and docker.

Before you run tests, provide test database credentials in `phpunit.env` (you can copy `phpunit.env.dist`, removing the comment in the first line). Then start your `mysqld` service.

Tests are in `tests`; to run them, do `composer test`. To fix code style issues, do `composer fix`.
1. npm install
2. npm run test
You can set the `WP_ENV_PHP_VERSION` enviormental variable to test with different versions of PHP. If you are changing the version, you can do so by running `WP_ENV_PHP_VERSION="8.2" npm run wp-env start -- --update` and setting the enviornmental variable based on

## Tagging

Expand Down
127 changes: 0 additions & 127 deletions bin/install-wp-tests.sh

This file was deleted.

22 changes: 22 additions & 0 deletions bin/update-composer-dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Print Commands
set -x

# Exit on error
set -e

# Change to the parent directory of this script
cd "$(dirname "$(dirname "$(readlink -fm "$0")")")"

# restart the container in PHP 7
WP_ENV_PHP_VERSION="7.0" npm run wp-env start -- --update

# install composer dependencies
WP_ENV_PHP_VERSION="7.0" npm run wp-env -- run --env-cwd='wp-content/plugins/rollbar-php-wordpress/php7' tests-cli composer update

# restart the container in PHP 8.0
WP_ENV_PHP_VERSION="8.0" npm run wp-env start -- --update

# install composer dependencies
WP_ENV_PHP_VERSION="8.0" npm run wp-env -- run --env-cwd='wp-content/plugins/rollbar-php-wordpress/php8' tests-cli composer update
Loading
Loading