Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ trim_trailing_whitespace = true
indent_style = tab
indent_size = 4

[*.json,*.yml,*.feature]
[*.{ts,tsx,js,jsx,scss,css,json,yaml,yml,feature,xml}]
indent_style = space
indent_size = 2

# Dotfiles
[.*]
indent_style = space
indent_size = 2
29 changes: 29 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# Exclude these files from release archives.
#
# This will also make the files unavailable when using Composer with `--prefer-dist`.
#
# Via WPCS.
#
/.github export-ignore
/.phpcs export-ignore
/apigen.neon export-ignore
/package.json export-ignore
/phpcs.xml export-ignore
/phpunit.xml export-ignore
/rector.php export-ignore
/tests export-ignore

#
# Auto detect text files and perform LF normalization.
#
# http://davidlaing.com/2012/09/19/customise-your-gitattributes-to-become-a-git-ninja/
#
* text=auto

#
# The above will handle all files not found below.
#
*.md text
*.php text
*.inc text
70 changes: 70 additions & 0 deletions .github/workflows/all-pr-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: "All Pull Request Tests"

on:
push:
branches:
- develop
- main
pull_request:
branches:
- develop
- main
types: [opened, synchronize, reopened, ready_for_review]

jobs:
# We use a single job to ensure that all steps run in the same environment and
# reduce the number of minutes used.
pr-tests:
# Don't run on draft PRs
if: github.event.pull_request.draft == false
# Timeout after 10 minutes
timeout-minutes: 10
# Define a matrix of PHP/WordPress versions to test against
strategy:
fail-fast: false
matrix:
php: [8.1, 8.2, 8.3, 8.4]
wordpress: ["latest"]
multisite: ['true', 'false']
runs-on: ubuntu-latest
# Cancel any existing runs of this workflow
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}-P${{ matrix.php }}-WP${{ matrix.wordpress }}-MS${{ matrix.multisite }}
cancel-in-progress: true
# Name the job in the matrix
name: "PR Tests PHP ${{ matrix.php }} WordPress ${{ matrix.wordpress }} Multisite ${{ matrix.multisite }}"
steps:
- uses: actions/checkout@v5

- name: Run General Tests
# See https://github.com/alleyinteractive/action-test-general for more options
uses: alleyinteractive/action-test-general@develop

- name: Run PHP Tests
# See https://github.com/alleyinteractive/action-test-php for more options
uses: alleyinteractive/action-test-php@develop
with:
php-version: '${{ matrix.php }}'
wordpress-version: '${{ matrix.wordpress }}'
wordpress-multisite: '${{ matrix.multisite }}'
skip-wordpress-install: 'true'
# This required job ensures that all PR checks have passed before merging.
all-pr-checks-passed:
name: All PR checks passed
needs:
- pr-tests
runs-on: ubuntu-latest
if: always()
steps:
- name: Check job statuses
run: |
if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then
echo "One or more jobs failed"
exit 1
elif [[ "${{ contains(needs.*.result, 'cancelled') }}" == "true" ]]; then
echo "One or more jobs were cancelled"
exit 1
else
echo "All jobs passed or were skipped"
exit 0
fi
12 changes: 0 additions & 12 deletions .github/workflows/phpcs.yml

This file was deleted.

83 changes: 0 additions & 83 deletions .github/workflows/phpunit.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Dependencies
vendor
!tests/js/vendor
node_modules
.env
composer.lock
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Fieldmanager is a powerful library which can make the development of sophisticat
## Requirements

* WordPress: 5.8+
* PHP: 7.4+
* PHP: 8.1+

## Downloads and Versioning.

Expand Down
14 changes: 10 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,27 @@
}
],
"require": {
"php": ">=8.1",
"composer/installers": "^1.0 || ^2.0"
},
"require-dev": {
"alleyinteractive/alley-coding-standards": "^0.3.0",
"yoast/phpunit-polyfills": "^1.0"
"alleyinteractive/alley-coding-standards": "^1.0",
"mantle-framework/testkit": "^1.3"
},
"scripts": {
"phpcs": "vendor/bin/phpcs",
"phpcbf": "vendor/bin/phpcbf",
"phpunit": "vendor/bin/phpunit"
"phpunit": "vendor/bin/phpunit",
"test": [
"@phpcs",
"@phpunit"
]
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"composer/installers": true
"composer/installers": true,
"alleyinteractive/composer-wordpress-autoloader": true
}
}
}
17 changes: 0 additions & 17 deletions multisite.xml

This file was deleted.

37 changes: 15 additions & 22 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,25 +1,18 @@
<?xml version="1.0"?>
<phpunit
bootstrap="tests/php/bootstrap.php"
backupGlobals="false"
colors="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/php/bootstrap.php"
backupGlobals="false"
colors="true"
>
<testsuites>
<!-- Default test suite to run all tests -->
<testsuite name="Fieldmanager Tests">
<directory suffix=".php">tests</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>ajax</group>
</exclude>
</groups>
<logging>
<log type="junit" target="build/logs/junit.xml" />
</logging>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">php</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="Fieldmanager Tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="-1" />
<ini name="display_errors" value="1" />
</php>
</phpunit>
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<?php

use PHPUnit\Framework\Attributes\Group;

/**
* Tests the Fieldmanager Autocomplete Field
*
* @group field
* @group autocomplete
*/
class Test_Fieldmanager_Autocomplete_Field extends WP_UnitTestCase {
#[Group( 'autocomplete' )]
#[Group( 'field' )]
class FieldmanagerAutocompleteFieldTest extends WP_UnitTestCase {
/**
* The post ID of the test post.
*
Expand Down
Loading
Loading