Skip to content
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

Misc updates #3

Merged
merged 5 commits into from
May 25, 2024
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
1 change: 0 additions & 1 deletion .deployignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package-lock.json
phpunit.xml
phpunit.xml.dist
.phpunit.result.cache
multisite.xml
multisite.xml.dist
.phpcs.xml
phpcs.xml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
composer-phpcs-phpstan:
uses: alleyinteractive/.github/.github/workflows/php-composer-command.yml@main
with:
php: 8.2
php: 8.3
command: |
phpcs
phpstan
4 changes: 2 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false # do not fail fast, let all the failing tests fail.
matrix:
php: [8.2]
php: [8.3]
es_version: [7.17.5]
multisite: [0, 1]
wp_version: ["latest"]
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
security-enabled: false

- name: Check out code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up PHP
uses: shivammathur/setup-php@v2
Expand Down
4 changes: 2 additions & 2 deletions .phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
<exclude-pattern>*/**/tests/</exclude-pattern>

<!-- Configure the PHP version -->
<config name="testVersion" value="8.2-" />
<config name="testVersion" value="8.3-" />

<!-- Check against minimum WP version. -->
<config name="minimum_supported_wp_version" value="6.3" />
<config name="minimum_supported_wp_version" value="6.1" />

<!-- Set the text domain for i18n. -->
<rule ref="WordPress.WP.I18n">
Expand Down
28 changes: 17 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,40 +44,46 @@
}
],
"require": {
"php": "^8.2",
"php": "^8.3",
"spatie/elasticsearch-query-builder": "^1.0"
},
"require-dev": {
"alleyinteractive/alley-coding-standards": "^2.0.1",
"alleyinteractive/pest-plugin-wordpress": "^0.1.0",
"alleyinteractive/alley-coding-standards": "^2.0",
"alleyinteractive/pest-plugin-wordpress": "^0.5",
"buddypress/buddypress": "dev-master",
"mantle-framework/testkit": "^0.12",
"mantle-framework/testkit": "^1.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan": "^1.10",
"szepeviktor/phpstan-wordpress": "^1.1.6",
"wp-phpunit/wp-phpunit": "^6.3",
"wpackagist-plugin/elasticpress": "^4.6.1"
"szepeviktor/phpstan-wordpress": "^1.3",
"wpackagist-plugin/elasticpress": "^4.6"
},
"scripts": {
"phpcs": "phpcs . --basepath=.",
"phpcbf": "phpcbf . --basepath=.",
"phpstan": [
"phpstan analyze --ansi --memory-limit=1G"
],
"phpunit": "pest"
"phpunit": "pest",
"test_multi": "WP_MULTISITE=1 pest"
},
"config": {
"platform": {
"php": "8.2"
"php": "8.3"
},
"optimize-autoloader": true,
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true,
"composer/installers": true,
"alleyinteractive/composer-wordpress-autoloader": true,
"pestphp/pest-plugin": true
"pestphp/pest-plugin": true,
"composer/installers": true
}
},
"autoload-dev": {
"psr-4": {
"Elasticsearch\\BuddyPress\\": "src/",
"Elasticsearch\\BuddyPress\\Tests\\": "tests"
}
},
"extra": {
Expand Down
43 changes: 36 additions & 7 deletions elasticsearch-buddypress.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,49 @@
* Author: Renato Alves
* Author URI: https://ralv.es
* Text Domain: elasticsearch-buddypress
* Domain Path: /languages/
* Requires PHP: 8.2
* Requires WP: 5.9
* Tested up to: 6.3
* Requires PHP: 8.3
* Requires WP: 6.1
* Tested up to: 6.5.2
* Requires Plugins: buddypress
* License: GPL-3.0-or-later
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress;

// Plugin autoloader.
require_once __DIR__ . '/vendor/wordpress-autoload.php';
/* Start Composer Loader */

// Check if Composer is installed.
if ( ! file_exists( __DIR__ . '/vendor/wordpress-autoload.php' ) ) {
if ( ! class_exists( \Composer\InstalledVersions::class ) ) {
\add_action(
'admin_notices',
function () {
?>
<div class="notice notice-error">
<p>
<?php
esc_html_e(
'ElasticSearch BuddyPress appears to have been installed without its dependencies. It will not work properly until dependencies are installed. This likely means you have cloned it from Github and need to run the command `composer install`.',
'elasticsearch-buddypress'
);
?>
</p>
</div>
<?php
}
);

return;
}
} else {
// Load Composer dependencies.
require_once __DIR__ . '/vendor/wordpress-autoload.php';
}

/* End Composer Loader */

/**
* Getting the instance of the controller class.
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parameters:
level: 8
level: 1
paths:
- elasticsearch-buddypress.php
- src/
Expand Down
24 changes: 10 additions & 14 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<?xml version="1.0"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
bootstrap="tests/bootstrap.php"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
>
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerWarnings="true"
failOnNotice="true"
failOnDeprecation="true"
>
<testsuites>
<testsuite>
<directory suffix=".php">./tests/</directory>
<testsuite name="elasticsearch-buddypress">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./</directory>
<exclude>
<directory suffix=".php">./tests/</directory>
</exclude>
</whitelist>
</filter>
</phpunit>
6 changes: 3 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Contributors: espellcaste
Tags: buddypress, elasticsearch, elasticpress
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Requires PHP: 8.2
Requires at least: 5.9
Tested up to: 6.3
Requires PHP: 8.3
Requires at least: 6.1
Tested up to: 6.5.2
Stable tag: 0.1.0-alpha

== Description ==
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/Adapter.php → src/Adapters/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Adapters;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Adapters\ElasticPress;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Adapters\ElasticPress\Features\Groups;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Adapters\ElasticPress\Features\Groups;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Adapters\ElasticPress\Features\Groups;

use WP_Term;
use WP_User;
use WP_Taxonomy;
use WP_Error;
use ElasticPress\Indexable as EP_Indexable;

/**
Expand Down Expand Up @@ -166,7 +167,7 @@ public function prepapre_terms( int $group_id ): array {
foreach ( $selected_taxonomies as $taxonomy ) {
$object_terms = bp_get_object_terms( $group_id, $taxonomy->name );

if ( ! $object_terms || is_wp_error( $object_terms ) ) {
if ( ! $object_terms || $object_terms instanceof WP_Error ) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Adapters\ElasticPress\Features\Groups;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Adapters\ElasticPress\Features\Groups;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

return [
'settings' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Adapters;

Expand Down
8 changes: 3 additions & 5 deletions src/class-controller.php → src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress;

use Elasticsearch\BuddyPress\Interfaces\Hookable;
use Elasticsearch\BuddyPress\Adapters\Adapter;
use Elasticsearch\BuddyPress\Adapters\ElasticPress\ElasticPress;
use Elasticsearch\BuddyPress\Interfaces\Hookable;

/**
* The controller class, which is responsible for loading adapters and
Expand All @@ -28,8 +28,6 @@ class Controller implements Hookable {

/**
* A callback for the init action hook.
*
* @todo Confirm if this is still needed.
*/
public function action__init(): void {
/**
Expand Down Expand Up @@ -90,7 +88,7 @@ public function missing_notice(): void {
<div class="notice notice-error">
<p>
<strong><?php esc_html_e( 'Elasticsearch BuddyPress', 'elasticsearch-buddypress' ); ?></strong>
<?php esc_html_e( 'depends on the lastest version of Buddypress to work!', 'elasticsearch-buddypress' ); ?>
<?php esc_html_e( 'depends on the latest version of Buddypress to work!', 'elasticsearch-buddypress' ); ?>
</p>
</div>
<?php
Expand Down
2 changes: 1 addition & 1 deletion src/class-factory.php → src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Interfaces;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Interfaces;

Expand Down
2 changes: 1 addition & 1 deletion src/class-registry.php → src/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @package Elasticsearch\BuddyPress
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @package Elasticsearch\BuddyPress\Tests
*/

declare(strict_types=1);
declare( strict_types=1 );

namespace Elasticsearch\BuddyPress\Tests;

Expand Down
Loading
Loading