Skip to content

Commit

Permalink
Merge branch 'develop' of ssh://github.com/johnbillion/extended-cpts …
Browse files Browse the repository at this point in the history
…into support-taxonomy-extend
  • Loading branch information
nlemoine committed Mar 9, 2022
2 parents d6ad39e + d6d83bb commit 2df77d5
Show file tree
Hide file tree
Showing 45 changed files with 2,153 additions and 1,594 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false

[{*.json,*.yml}]
[*.yml]
indent_style = space
indent_size = 2
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/codeception.dist.yml export-ignore
/CONTRIBUTING.md export-ignore
/phpcs.xml.dist export-ignore
/phpunit.xml.dist export-ignore
/phpstan.neon.dist export-ignore
35 changes: 35 additions & 0 deletions .github/workflows/test-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test Nightly
on:
# Once weekly on Wednesdays at 02:00 UTC.
schedule:
- cron: '0 2 * * 3'
workflow_dispatch:

jobs:
build:
strategy:
matrix:
php: ['8.1','8.0','7.4']
fail-fast: false
name: WP nightly / PHP ${{ matrix.php }}
runs-on: ubuntu-18.04
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Install PHP
uses: shivammathur/setup-php@2.7.0
with:
php-version: ${{ matrix.php }}
extensions: mysqli, xmlwriter
coverage: none

- name: Install dependencies
run: |
sudo systemctl start mysql.service
composer install --prefer-dist
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress="dev-nightly"
mysqladmin -uroot -proot create wordpress_test
- name: Run the tests
run: composer test
54 changes: 32 additions & 22 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
name: Test
on: [push, pull_request]
on:
push:
branches:
- 'develop'
- 'trunk'
pull_request:
branches:
- '**'

jobs:
build:
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
matrix:
php: ['7.4', '7.0']
wp: ['4.9', '*', 'dev-nightly']
php: ['7.4']
wp: ['5.8','5.6']
include:
- php: '8.0'
wp: '5.8'
- php: '8.1'
wp: '5.8'
fail-fast: false
name: WP ${{ matrix.wp }} / PHP ${{ matrix.php }}
runs-on: ubuntu-18.04
services:
mysql:
image: mysql:5.7
env:
MYSQL_DATABASE: wordpress
MYSQL_ALLOW_EMPTY_PASSWORD: yes
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- name: Checkout repository
uses: actions/checkout@v1
uses: actions/checkout@v2

- name: Composer cache
uses: actions/cache@v1
Expand All @@ -32,8 +34,9 @@ jobs:
path: ~/.composer/cache
key: ${{ matrix.php }}-${{ env.cache-name }}-${{ hashFiles('composer.json') }}

- name: PHPCS cache
uses: actions/cache@v1
- name: PHPCS and PHPStan cache
if: matrix.php == '7.4'
uses: actions/cache@v2
env:
cache-name: phpcs
with:
Expand All @@ -55,13 +58,20 @@ jobs:
php --version
php -m
composer --version
mysql --version
- name: Install dependencies
run: |
composer install --prefer-dist --no-suggest
composer require --dev --update-with-dependencies --no-suggest --prefer-dist roots/wordpress="${{ matrix.wp }} || *" wp-phpunit/wp-phpunit="${{ matrix.wp }} || *"
sudo systemctl start mysql.service
composer install --prefer-dist
composer require --dev --update-with-dependencies --prefer-dist roots/wordpress="~${{ matrix.wp }}.0"
mysqladmin -uroot -proot create wordpress_test
- name: Run the tests
run: composer test
env:
WP_TESTS_DB_HOST: 127.0.0.1:${{ job.services.mysql.ports['3306'] }}
- name: Run the integration tests
run: composer test:integration

- name: Run the code sniffers
if: matrix.php == '7.4'
run: |
composer test:cs
composer test:analyze
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
/codeception.yml
/composer.lock
/phpcs.xml
/phpunit.xml
/phpstan.neon
/tests/_output/
/tests/_support/_generated
/tests/.env
/tests/cache
/tests/wordpress
Expand Down
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[![Build Status](https://img.shields.io/github/workflow/status/johnbillion/extended-cpts/Test/develop?style=flat-square)](https://github.com/johnbillion/extended-cpts/actions)
[![Stable Release](https://img.shields.io/packagist/v/johnbillion/extended-cpts.svg)](https://packagist.org/packages/johnbillion/extended-cpts)
[![License](https://img.shields.io/badge/license-GPL_v2%2B-blue.svg)](https://github.com/johnbillion/extended-cpts/blob/master/LICENSE)
[![PHP 7](https://img.shields.io/badge/php-7%20/%208-blue.svg)](https://wordpress.org/support/update-php/)
[![Documentation](https://img.shields.io/badge/documentation-wiki-blue.svg)](https://github.com/johnbillion/extended-cpts/wiki)
[![Stable Release](https://img.shields.io/packagist/v/johnbillion/extended-cpts.svg?style=flat-square)](https://packagist.org/packages/johnbillion/extended-cpts)
[![License](https://img.shields.io/badge/license-GPL_v2%2B-blue.svg?style=flat-square)](https://github.com/johnbillion/extended-cpts/blob/trunk/LICENSE)
[![PHP 7 and 8](https://img.shields.io/badge/php-7%20/%208-blue.svg?style=flat-square)](https://wordpress.org/support/update-php/)
[![Documentation](https://img.shields.io/badge/documentation-wiki-blue.svg?style=flat-square)](https://github.com/johnbillion/extended-cpts/wiki)

# Extended CPTs #

Expand Down Expand Up @@ -59,11 +59,12 @@ Not your first time here? See [Recent Changes for Developers](https://github.com

## Minimum Requirements ##

* **PHP:** 7.0
- PHP 7.4+ is recommended
- PHP 8 is supported
* **WordPress:** 4.8
- Tested up to WP 5.6
* **PHP:** 7.4
- PHP 8.0 and 8.1 are supported
* **WordPress:** 5.6
- Tested up to WP 5.8

Extended CPTs should work with versions of WordPress back to 4.9 but these versions are not tested and not officially supported.

## Installation ##

Expand All @@ -75,8 +76,6 @@ composer require johnbillion/extended-cpts

Other means of installation or usage, particularly bundling within a plugin, is not officially supported and done at your own risk.

Note that *Extended Taxonomies* is part of this library since version 4.0, so there's no need to require that too.

## Usage ##

Need a simple post type with no frills? You can register a post type with a single parameter:
Expand Down Expand Up @@ -111,9 +110,6 @@ add_action( 'init', function() {
'nopaging' => true,
],

# Add the post type to the 'Recently Published' section of the dashboard:
'dashboard_activity' => true,

# Add some custom columns to the admin screen:
'admin_cols' => [
'story_featured_image' => [
Expand Down
12 changes: 12 additions & 0 deletions codeception.dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
actor_suffix: Tester
extensions:
enabled:
- Codeception\Extension\RunFailed
params:
- tests/.env
56 changes: 39 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,49 +11,71 @@
],
"config": {
"sort-packages": true,
"preferred-install": "dist"
"preferred-install": "dist",
"allow-plugins": {
"cweagans/composer-patches": true,
"dealerdirect/phpcodesniffer-composer-installer": true,
"roots/wordpress-core-installer": true
}
},
"extra": {
"branch-alias": {
"dev-develop": "5.0-dev"
},
"patches": {
"lucatume/wp-browser": {
"https://github.com/lucatume/wp-browser/issues/554": "tests/patches/wp-browser-554.patch"
}
},
"wordpress-install-dir": "tests/wordpress"
},
"require": {
"php": "^7 | ^8"
"php": ">= 7.4.0",
"johnbillion/args": "^0.9.0"
},
"require-dev": {
"automattic/phpcs-neutron-standard": "1.6.0",
"automattic/phpcs-neutron-standard": "1.7.0",
"cweagans/composer-patches": "^1.7",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7",
"johnbillion/falsey-assertequals-detector": "^2",
"johnbillion/falsey-assertequals-detector": "*",
"lucatume/wp-browser": "^3.0",
"phpcompatibility/phpcompatibility-wp": "^2",
"phpunit/phpunit": "^6",
"roots/wordpress": "*",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9",
"roots/wordpress": "^5.8.0",
"szepeviktor/phpstan-wordpress": "^1.0",
"vlucas/phpdotenv": "^3",
"wp-cli/db-command": "^2.0",
"wp-coding-standards/wpcs": "2.3.0",
"wp-phpunit/wp-phpunit": "*"
"wp-cli/core-command": "^2",
"wp-cli/db-command": "^2",
"wp-coding-standards/wpcs": "2.3.0"
},
"scripts": {
"post-update-cmd": [
"@php -r \"! file_exists( 'tests/.env' ) && copy( 'tests/.env.dist', 'tests/.env' );\""
],
"test:cs": [
"vendor/bin/phpcs -nps --colors --report-code --report-summary --report-width=80 --cache=tests/cache/phpcs ."
"phpcs -nps --colors --report-code --report-summary --report-width=80 --cache=tests/cache/phpcs --basepath='./' ."
],
"test:analyze": [
"phpstan analyze"
],
"test:ut": [
"vendor/bin/wp db reset --yes --path=tests/wordpress #",
"export WP_MULTISITE=0 && vendor/bin/phpunit --verbose --colors=always --exclude-group=ms-required",
"export WP_MULTISITE=1 && vendor/bin/phpunit --verbose --colors=always --exclude-group=ms-excluded"
"test:integration": [
"codecept run integration"
],
"test": [
"@test:cs",
"@test:ut"
"@test:analyze",
"@test:integration"
]
},
"autoload": {
"psr-4": {
"ExtCPTs\\Tests\\": "tests/phpunit"
"ExtCPTs\\": "src",
"ExtCPTs\\Tests\\": "tests/integration"
},
"files": [
"extended-cpts.php"
"functions.php"
]
},
"suggest": {
Expand Down
17 changes: 10 additions & 7 deletions extended-cpts.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
declare( strict_types=1 );

/**
* Extended custom post types for WordPress.
* Extended custom post types and taxonomies for WordPress.
*
* @package ExtendedCPTs
* @author John Blackbourn <https://johnblackbourn.com>
* @link https://github.com/johnbillion/extended-cpts
* @copyright 2012-2021 John Blackbourn
* @copyright 2012-2022 John Blackbourn
* @license GPL v2 or later
* @version 4.5.1
* @version 5.0.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -23,7 +23,10 @@
*/

require_once __DIR__ . '/functions.php';
require_once __DIR__ . '/src/class-extended-cpt.php';
require_once __DIR__ . '/src/class-extended-cpt-admin.php';
require_once __DIR__ . '/src/class-extended-taxonomy.php';
require_once __DIR__ . '/src/class-extended-taxonomy-admin.php';
require_once __DIR__ . '/src/PostType.php';
require_once __DIR__ . '/src/PostTypeAdmin.php';
require_once __DIR__ . '/src/Taxonomy.php';
require_once __DIR__ . '/src/TaxonomyAdmin.php';
require_once __DIR__ . '/src/Walker/Checkboxes.php';
require_once __DIR__ . '/src/Walker/Dropdown.php';
require_once __DIR__ . '/src/Walker/Radios.php';
Loading

0 comments on commit 2df77d5

Please sign in to comment.