Skip to content

Commit bfe7a75

Browse files
Merge pull request #3 from renatonascalves/feature/misc-updates
Misc updates
2 parents 5acdf59 + 24e80b2 commit bfe7a75

32 files changed

+143
-107
lines changed

.deployignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package-lock.json
1919
phpunit.xml
2020
phpunit.xml.dist
2121
.phpunit.result.cache
22-
multisite.xml
2322
multisite.xml.dist
2423
.phpcs.xml
2524
phpcs.xml

.github/workflows/code-quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
composer-phpcs-phpstan:
1111
uses: alleyinteractive/.github/.github/workflows/php-composer-command.yml@main
1212
with:
13-
php: 8.2
13+
php: 8.3
1414
command: |
1515
phpcs
1616
phpstan

.github/workflows/unit-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false # do not fail fast, let all the failing tests fail.
1515
matrix:
16-
php: [8.2]
16+
php: [8.3]
1717
es_version: [7.17.5]
1818
multisite: [0, 1]
1919
wp_version: ["latest"]
@@ -51,7 +51,7 @@ jobs:
5151
security-enabled: false
5252

5353
- name: Check out code
54-
uses: actions/checkout@v3
54+
uses: actions/checkout@v4
5555

5656
- name: Set up PHP
5757
uses: shivammathur/setup-php@v2

.phpcs.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
<exclude-pattern>*/**/tests/</exclude-pattern>
2929

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

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

3636
<!-- Set the text domain for i18n. -->
3737
<rule ref="WordPress.WP.I18n">

composer.json

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,40 +44,46 @@
4444
}
4545
],
4646
"require": {
47-
"php": "^8.2",
47+
"php": "^8.3",
4848
"spatie/elasticsearch-query-builder": "^1.0"
4949
},
5050
"require-dev": {
51-
"alleyinteractive/alley-coding-standards": "^2.0.1",
52-
"alleyinteractive/pest-plugin-wordpress": "^0.1.0",
51+
"alleyinteractive/alley-coding-standards": "^2.0",
52+
"alleyinteractive/pest-plugin-wordpress": "^0.5",
5353
"buddypress/buddypress": "dev-master",
54-
"mantle-framework/testkit": "^0.12",
54+
"mantle-framework/testkit": "^1.0",
5555
"phpstan/extension-installer": "^1.1",
5656
"phpstan/phpstan": "^1.10",
57-
"szepeviktor/phpstan-wordpress": "^1.1.6",
58-
"wp-phpunit/wp-phpunit": "^6.3",
59-
"wpackagist-plugin/elasticpress": "^4.6.1"
57+
"szepeviktor/phpstan-wordpress": "^1.3",
58+
"wpackagist-plugin/elasticpress": "^4.6"
6059
},
6160
"scripts": {
6261
"phpcs": "phpcs . --basepath=.",
6362
"phpcbf": "phpcbf . --basepath=.",
6463
"phpstan": [
6564
"phpstan analyze --ansi --memory-limit=1G"
6665
],
67-
"phpunit": "pest"
66+
"phpunit": "pest",
67+
"test_multi": "WP_MULTISITE=1 pest"
6868
},
6969
"config": {
7070
"platform": {
71-
"php": "8.2"
71+
"php": "8.3"
7272
},
7373
"optimize-autoloader": true,
7474
"sort-packages": true,
7575
"allow-plugins": {
7676
"dealerdirect/phpcodesniffer-composer-installer": true,
7777
"phpstan/extension-installer": true,
78-
"composer/installers": true,
7978
"alleyinteractive/composer-wordpress-autoloader": true,
80-
"pestphp/pest-plugin": true
79+
"pestphp/pest-plugin": true,
80+
"composer/installers": true
81+
}
82+
},
83+
"autoload-dev": {
84+
"psr-4": {
85+
"Elasticsearch\\BuddyPress\\": "src/",
86+
"Elasticsearch\\BuddyPress\\Tests\\": "tests"
8187
}
8288
},
8389
"extra": {

elasticsearch-buddypress.php

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,49 @@
1616
* Author: Renato Alves
1717
* Author URI: https://ralv.es
1818
* Text Domain: elasticsearch-buddypress
19-
* Domain Path: /languages/
20-
* Requires PHP: 8.2
21-
* Requires WP: 5.9
22-
* Tested up to: 6.3
19+
* Requires PHP: 8.3
20+
* Requires WP: 6.1
21+
* Tested up to: 6.5.2
22+
* Requires Plugins: buddypress
2323
* License: GPL-3.0-or-later
2424
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
2525
*/
2626

27-
declare(strict_types=1);
27+
declare( strict_types=1 );
2828

2929
namespace Elasticsearch\BuddyPress;
3030

31-
// Plugin autoloader.
32-
require_once __DIR__ . '/vendor/wordpress-autoload.php';
31+
/* Start Composer Loader */
32+
33+
// Check if Composer is installed.
34+
if ( ! file_exists( __DIR__ . '/vendor/wordpress-autoload.php' ) ) {
35+
if ( ! class_exists( \Composer\InstalledVersions::class ) ) {
36+
\add_action(
37+
'admin_notices',
38+
function () {
39+
?>
40+
<div class="notice notice-error">
41+
<p>
42+
<?php
43+
esc_html_e(
44+
'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`.',
45+
'elasticsearch-buddypress'
46+
);
47+
?>
48+
</p>
49+
</div>
50+
<?php
51+
}
52+
);
53+
54+
return;
55+
}
56+
} else {
57+
// Load Composer dependencies.
58+
require_once __DIR__ . '/vendor/wordpress-autoload.php';
59+
}
60+
61+
/* End Composer Loader */
3362

3463
/**
3564
* Getting the instance of the controller class.

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 8
2+
level: 1
33
paths:
44
- elasticsearch-buddypress.php
55
- src/

phpunit.xml.dist

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1+
<?xml version="1.0"?>
12
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24
bootstrap="tests/bootstrap.php"
35
backupGlobals="false"
46
colors="true"
5-
convertErrorsToExceptions="true"
6-
convertNoticesToExceptions="true"
7-
convertWarningsToExceptions="true"
8-
>
7+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
8+
displayDetailsOnTestsThatTriggerDeprecations="true"
9+
displayDetailsOnTestsThatTriggerWarnings="true"
10+
failOnNotice="true"
11+
failOnDeprecation="true"
12+
>
913
<testsuites>
10-
<testsuite>
11-
<directory suffix=".php">./tests/</directory>
14+
<testsuite name="elasticsearch-buddypress">
15+
<directory suffix="Test.php">./tests/</directory>
1216
</testsuite>
1317
</testsuites>
14-
<filter>
15-
<whitelist processUncoveredFilesFromWhitelist="true">
16-
<directory suffix=".php">./</directory>
17-
<exclude>
18-
<directory suffix=".php">./tests/</directory>
19-
</exclude>
20-
</whitelist>
21-
</filter>
2218
</phpunit>

readme.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ Contributors: espellcaste
33
Tags: buddypress, elasticsearch, elasticpress
44
License: GPL-3.0-or-later
55
License URI: https://www.gnu.org/licenses/gpl-3.0.html
6-
Requires PHP: 8.2
7-
Requires at least: 5.9
8-
Tested up to: 6.3
6+
Requires PHP: 8.3
7+
Requires at least: 6.1
8+
Tested up to: 6.5.2
99
Stable tag: 0.1.0-alpha
1010

1111
== Description ==

src/adapters/Adapter.php renamed to src/Adapters/Adapter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

1010
namespace Elasticsearch\BuddyPress\Adapters;
1111

src/adapters/elasticpress/Elasticpress.php renamed to src/Adapters/ElasticPress/ElasticPress.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

1010
namespace Elasticsearch\BuddyPress\Adapters\ElasticPress;
1111

src/adapters/elasticpress/Features/Groups/Feature.php renamed to src/Adapters/ElasticPress/Features/Groups/Group.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

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

src/adapters/elasticpress/Features/Groups/GroupFormatArgs.php renamed to src/Adapters/ElasticPress/Features/Groups/GroupFormatArgs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

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

src/adapters/elasticpress/Features/Groups/Indexable.php renamed to src/Adapters/ElasticPress/Features/Groups/Indexable.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

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

1212
use WP_Term;
1313
use WP_User;
1414
use WP_Taxonomy;
15+
use WP_Error;
1516
use ElasticPress\Indexable as EP_Indexable;
1617

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

169-
if ( ! $object_terms || is_wp_error( $object_terms ) ) {
170+
if ( ! $object_terms || $object_terms instanceof WP_Error ) {
170171
continue;
171172
}
172173

src/adapters/elasticpress/Features/Groups/QueryIntegration.php renamed to src/Adapters/ElasticPress/Features/Groups/QueryIntegration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

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

src/adapters/elasticpress/Features/Groups/SyncManager.php renamed to src/Adapters/ElasticPress/Features/Groups/SyncManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @package Elasticsearch\BuddyPress
88
*/
99

10-
declare(strict_types=1);
10+
declare( strict_types=1 );
1111

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

src/adapters/elasticpress/Features/Groups/mapping.php renamed to src/Adapters/ElasticPress/Features/Groups/mapping.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

1010
return [
1111
'settings' => [

src/adapters/FormatArgs.php renamed to src/Adapters/FormatArgs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

1010
namespace Elasticsearch\BuddyPress\Adapters;
1111

src/class-controller.php renamed to src/Controller.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

1010
namespace Elasticsearch\BuddyPress;
1111

12+
use Elasticsearch\BuddyPress\Interfaces\Hookable;
1213
use Elasticsearch\BuddyPress\Adapters\Adapter;
1314
use Elasticsearch\BuddyPress\Adapters\ElasticPress\ElasticPress;
14-
use Elasticsearch\BuddyPress\Interfaces\Hookable;
1515

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

2929
/**
3030
* A callback for the init action hook.
31-
*
32-
* @todo Confirm if this is still needed.
3331
*/
3432
public function action__init(): void {
3533
/**
@@ -90,7 +88,7 @@ public function missing_notice(): void {
9088
<div class="notice notice-error">
9189
<p>
9290
<strong><?php esc_html_e( 'Elasticsearch BuddyPress', 'elasticsearch-buddypress' ); ?></strong>
93-
<?php esc_html_e( 'depends on the lastest version of Buddypress to work!', 'elasticsearch-buddypress' ); ?>
91+
<?php esc_html_e( 'depends on the latest version of Buddypress to work!', 'elasticsearch-buddypress' ); ?>
9492
</p>
9593
</div>
9694
<?php

src/class-factory.php renamed to src/Factory.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

1010
namespace Elasticsearch\BuddyPress;
1111

src/interfaces/Formatter.php renamed to src/Interfaces/Formatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

1010
namespace Elasticsearch\BuddyPress\Interfaces;
1111

src/interfaces/Hookable.php renamed to src/Interfaces/Hookable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

1010
namespace Elasticsearch\BuddyPress\Interfaces;
1111

src/class-registry.php renamed to src/Registry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package Elasticsearch\BuddyPress
66
*/
77

8-
declare(strict_types=1);
8+
declare( strict_types=1 );
99

1010
namespace Elasticsearch\BuddyPress;
1111

tests/adapters/elasticpress/ApiTest.php renamed to tests/Adapters/ElasticPress/ApiTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @package Elasticsearch\BuddyPress\Tests
77
*/
88

9-
declare(strict_types=1);
9+
declare( strict_types=1 );
1010

1111
namespace Elasticsearch\BuddyPress\Tests;
1212

0 commit comments

Comments
 (0)