Skip to content

Commit

Permalink
feat: use WordPress plugin dependency feature (#73)
Browse files Browse the repository at this point in the history
* feat: use WordPress plugin dependency feature

* ci: attempt to fix test failures

* ci: attempt to fix test failures

* Update standards-and-tests.yml

---------

Co-authored-by: Ricardo Aragon <[email protected]>
  • Loading branch information
greatislander and richard015ar authored Apr 8, 2024
1 parent e939396 commit 474a389
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 23 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/standards-and-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
matrix:
php: [ 8.1, 8.2 ]
os: [ubuntu-20.04]
wordpress: [6.2, latest]
wordpress: ['6.5', latest]
include:
- experimental: true
- experimental: false
php: 8.1
wordpress: 6.2
wordpress: '6.5'
name: Tests - PHP ${{ matrix.php }} - WP ${{ matrix.wordpress }}

steps:
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"require-dev": {
"phpcompatibility/php-compatibility": "^9.3",
"pressbooks/coding-standards": "^1.1",
"yoast/phpunit-polyfills": "^1.0.1"
"yoast/phpunit-polyfills": "^1.1"
},
"scripts": {
"test": [
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 2 additions & 13 deletions excalibur.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Plugin URI: https://github.com/pressbooks/excalibur/
GitHub Plugin URI: pressbooks/excalibur
Release Asset: true
Requires at least: 6.5
Requires Plugins: pressbooks
Description: Excalibur is a SWORD protocol client for Pressbooks.
Version: 0.7.0
Author: Pressbooks (Book Oven Inc.)
Expand All @@ -14,19 +16,6 @@
Network: True
*/

// -------------------------------------------------------------------------------------------------------------------
// Check minimum requirements
// -------------------------------------------------------------------------------------------------------------------

if ( ! function_exists( 'pb_meets_minimum_requirements' ) && ! @include_once( WP_PLUGIN_DIR . '/pressbooks/compatibility.php' ) ) { // @codingStandardsIgnoreLine
add_action('admin_notices', function () {
echo '<div id="message" role="alert" class="error fade"><p>' . __( 'Cannot find Pressbooks install.', 'excalibur' ) . '</p></div>';
});
return;
} elseif ( ! pb_meets_minimum_requirements() ) {
return;
}

// -------------------------------------------------------------------------------------------------------------------
// Class autoloader
// -------------------------------------------------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
* Manually load the plugin being tested.
*/
function _manually_load_plugin() {
require_once( __DIR__ . '/../../pressbooks/hm-autoloader.php' );
require_once( __DIR__ . '/../../pressbooks/pressbooks.php' );
require_once( __DIR__ . '/../../pressbooks/requires.php' );
require_once( __DIR__ . '/../../pressbooks/requires-admin.php' );
require_once( __DIR__ . '/../excalibur.php' );
}

Expand Down

0 comments on commit 474a389

Please sign in to comment.