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
2 changes: 1 addition & 1 deletion .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
- name: Composer dependencies
run: composer install
- name: Run Testsuite
run: composer run-script cs
run: composer run-script phpcs
3 changes: 2 additions & 1 deletion .github/workflows/plugin-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ jobs:
- name: Run plugin check
uses: wordpress/plugin-check-action@v1
with:
build-dir: './multisyde'
build-dir: './multisyde'
exclude-files: 'modules/**/patches/*.php'
5 changes: 5 additions & 0 deletions .phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@
<arg name="extensions" value="php"/>
<arg name="cache" value=".phpcs.cache"/>

<rule ref="PHPCompatibilityWP" />

<rule ref="WordPress">
<!-- PSR4 -->
<exclude name="WordPress.Files.FileName" />
</rule>
<rule ref="WordPress-Extra"/>
<rule ref="WordPress-Docs"/>

<exclude-pattern>*/node_modules/*</exclude-pattern>
<exclude-pattern>*/vendor/*</exclude-pattern>
</ruleset>
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"phpstan/extension-installer": true
"phpstan/extension-installer": true,
"lloc/composer-i18n-scripts": true
}
},
"require-dev": {
Expand All @@ -45,19 +46,20 @@
"yoast/phpunit-polyfills": "^3.1",
"phpunit/phpunit": "^9.6",
"brain/monkey": "^2.0@dev",
"phpstan/phpstan-mockery": "^2.0"
"phpstan/phpstan-mockery": "^2.0",
"lloc/composer-i18n-scripts": "^1.0",
"phpcompatibility/phpcompatibility-wp": "^2.1"
},
"scripts": {
"tests": "./vendor/bin/phpunit -c ./phpunit.xml.dist",
"tests:coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit -c ./phpunit.xml.dist --coverage-html ./tests/coverage",
"cs": "./vendor/bin/phpcs .",
"cs:fix": "./vendor/bin/phpcbf .",
"phpcs": "vendor/bin/phpcs .",
"phpcbf": "./vendor/bin/phpcbf .",
"phpstan": "./vendor/bin/phpstan analyse --memory-limit=1G",
"qa": [
"@cs",
"@phpstan"
],
"i18n:pot": "wp i18n make-pot . languages/multisyde.pot",
"git-release": "bin/git-release.sh",
"build": [
"@composer install --no-dev",
Expand Down
3 changes: 2 additions & 1 deletion modules/SiteActivePlugins/Feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
const NOTICE_DEACTIVATION = 'bulk_deactivated';

const DEFAULT_MAX_SITES = 100;
const FILTER_MAX_SITES = 'multisyde_site_active_plugins_max_sites';

/**
* The active plugins in the sites in the network.
Expand Down Expand Up @@ -161,7 +162,7 @@
*
* @param int $max_sites The maximum number of sites to show for each plugin.
*/
$max_sites = apply_filters( 'site_active_plugins_max_sites', self::DEFAULT_MAX_SITES );
$max_sites = apply_filters( self::FILTER_MAX_SITES, self::DEFAULT_MAX_SITES );

Check warning on line 165 in modules/SiteActivePlugins/Feature.php

View workflow job for this annotation

GitHub Actions / plugin-check

WordPress.NamingConventions.PrefixAllGlobals.DynamicHooknameFound

Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: &quot;self::FILTER_MAX_SITES&quot;.
$site_ids = get_sites(
array(
'fields' => 'ids',
Expand Down
2 changes: 1 addition & 1 deletion modules/SiteActivePlugins/tests/unit/TestFeature.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public function test_populate_active_plugins_network_active(): void {
public function test_populate_active_plugins_max_sites(): void {
$max_sites = 5;

Filters\expectApplied( 'site_active_plugins_max_sites' )->once()->with( 100 )->andReturn( $max_sites );
Filters\expectApplied( Feature::FILTER_MAX_SITES )->once()->with( 100 )->andReturn( $max_sites );

$args = array(
'fields' => 'ids',
Expand Down
Loading