Wordpress 7+
Tests / tests (push) Canceled after 0s

This commit is contained in:
sandros committed 2026-09-26 22:32:01 +02:00
1 parent 17eaad7a92
commit 99646663d6
7 files changed
+38 -8

No files matched your search

+1 -1
View File
@@ -15,7 +15,7 @@ jobs:
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '7.2' php-version: '7.4'
tools: phpunit:8,psalm:4 tools: phpunit:8,psalm:4
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+5
View File
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased ## Unreleased
### Changed
- raised minimum required PHP version to 7.4 to align with WordPress 7.0+
- added `Requires at least: 7.0` to plugin header
- checked user permissions (`laps_can_see`) before enqueueing assets in `Asset_Manager`
## 3.3.7 - 2022-06-16 ## 3.3.7 - 2022-06-16
### Fixed ### Fixed
+1 -1
View File
@@ -82,7 +82,7 @@ class RoboFile extends \Robo\Tasks {
* *
* @param string $php PHP version to target. * @param string $php PHP version to target.
*/ */
public function makeArchive( $php = '7.2.5' ): void { public function makeArchive( $php = '7.4' ): void {
$composer = json_decode( file_get_contents( __DIR__ . '/composer.json' ) ); $composer = json_decode( file_get_contents( __DIR__ . '/composer.json' ) );
$package = $composer->name; $package = $composer->name;
+2 -2
View File
@@ -25,7 +25,7 @@
} }
}, },
"require" : { "require" : {
"php" : "^7.2.5 || ^8", "php" : "^7.4 || ^8",
"composer/installers": "^1.6 || ^2", "composer/installers": "^1.6 || ^2",
"symfony/stopwatch" : "^4.2.1", "symfony/stopwatch" : "^4.2.1",
"mustache/mustache" : "^2.14.1", "mustache/mustache" : "^2.14.1",
@@ -55,7 +55,7 @@
"composer/installers": true "composer/installers": true
}, },
"platform": { "platform": {
"php": "7.2.5" "php": "7.4"
} }
} }
} }
+4 -3
View File
@@ -7,7 +7,8 @@ Description: Light WordPress profiler.
Author: Andrey “Rarst” Savchenko Author: Andrey “Rarst” Savchenko
Version: 3.3.7 Version: 3.3.7
Author URI: https://www.rarst.net/ Author URI: https://www.rarst.net/
Requires PHP: 7.1.3 Requires at least: 7.0
Requires PHP: 7.4
Update URI: false Update URI: false
License: MIT License: MIT
*/ */
@@ -20,8 +21,8 @@ if ( ! class_exists( '\Rarst\Laps\Plugin' ) ) {
trigger_error( 'Laps not fully installed! Please install with Composer or download full release archive.', E_USER_ERROR ); trigger_error( 'Laps not fully installed! Please install with Composer or download full release archive.', E_USER_ERROR );
} }
if ( PHP_VERSION_ID < 70103 ) { if ( PHP_VERSION_ID < 70400 ) {
trigger_error( 'Laps requires PHP version >=7.1.3.', E_USER_ERROR ); trigger_error( 'Laps requires PHP version >=7.4.', E_USER_ERROR );
} }
$laps = new \Rarst\Laps\Plugin(); $laps = new \Rarst\Laps\Plugin();
+1 -1
View File
@@ -26,7 +26,7 @@ class Asset_Manager {
wp_register_script( 'laps', plugins_url( "public/js/laps{$suffix}.js", dirname( __DIR__ ) ), [ 'jquery' ], '3.4.0', true ); wp_register_script( 'laps', plugins_url( "public/js/laps{$suffix}.js", dirname( __DIR__ ) ), [ 'jquery' ], '3.4.0', true );
wp_register_style( 'laps', plugins_url( "public/css/laps{$suffix}.css", dirname( __DIR__ ) ) ); wp_register_style( 'laps', plugins_url( "public/css/laps{$suffix}.css", dirname( __DIR__ ) ) );
if ( is_admin_bar_showing() ) { if ( is_admin_bar_showing() && apply_filters( 'laps_can_see', current_user_can( 'manage_options' ) ) ) {
wp_enqueue_script( 'laps' ); wp_enqueue_script( 'laps' );
wp_enqueue_style( 'laps' ); wp_enqueue_style( 'laps' );
} }
+24
View File
@@ -36,9 +36,33 @@ class AssetTest extends LapsTestCase {
Functions\expect( 'wp_register_style' )->once(); Functions\expect( 'wp_register_style' )->once();
Functions\expect( 'plugins_url' )->zeroOrMoreTimes(); Functions\expect( 'plugins_url' )->zeroOrMoreTimes();
Functions\expect( 'is_admin_bar_showing' )->once()->andReturn( true ); Functions\expect( 'is_admin_bar_showing' )->once()->andReturn( true );
Functions\expect( 'current_user_can' )
->once()
->with( 'manage_options' )
->andReturn( true );
Functions\expect( 'wp_enqueue_script' )->once(); Functions\expect( 'wp_enqueue_script' )->once();
Functions\expect( 'wp_enqueue_style' )->once(); Functions\expect( 'wp_enqueue_style' )->once();
$manager->enqueue_scripts(); $manager->enqueue_scripts();
} }
/**
* @covers ::enqueue_scripts
* @depends test__construct
*/
public function testEnqueue_scripts_hidden( Asset_Manager $manager ) {
Functions\expect( 'wp_register_script' )->once();
Functions\expect( 'wp_register_style' )->once();
Functions\expect( 'plugins_url' )->zeroOrMoreTimes();
Functions\expect( 'is_admin_bar_showing' )->once()->andReturn( true );
Functions\expect( 'current_user_can' )
->once()
->with( 'manage_options' )
->andReturn( false );
Functions\expect( 'wp_enqueue_script' )->never();
Functions\expect( 'wp_enqueue_style' )->never();
$manager->enqueue_scripts();
}
} }