Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,8 @@ protected function look_for_plugin_updaters( Check_Result $result, array $php_fi
protected function look_for_updater_routines( Check_Result $result, array $php_files ) {

$look_for_regex = array(
'#auto_update_plugin#',
// Match the auto_update_plugin filter without matching the auto_update_plugins option.
'#auto_update_plugin\b#',
'#pre_set_site_transient_update_\w+#i',
'#_site_transient_update_\w+#i',
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/**
* Plugin Name: Test Plugin Updater Routines Native Option for Plugin Check
* Plugin URI: https://github.com/WordPress/plugin-check
* Description: Some plugin description.
* Requires at least: 6.0
* Requires PHP: 5.6
* Version: 1.0.0
* Author: WordPress Performance Team
* Author URI: https://make.wordpress.org/performance/
* License: GPLv2 or later
* License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* Text Domain: test-plugin-updater-routines-native-option
*
* @package test-plugin-updater-routines-native-option
*/

function test_plugin_updater_routines_native_option_read() {
return get_site_option( 'auto_update_plugins', array() );
}
12 changes: 12 additions & 0 deletions tests/phpunit/tests/Checker/Checks/Plugin_Updater_Check_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ public function test_run_without_any_errors() {
$this->assertEquals( 0, $check_result->get_warning_count() );
}

public function test_run_with_native_auto_update_option_no_warning() {
$check_context = new Check_Context( UNIT_TESTS_PLUGIN_DIR . 'test-plugin-updater-routines-native-option/load.php' );
$check_result = new Check_Result( $check_context );

$check = new Plugin_Updater_Check( Plugin_Updater_Check::TYPE_PLUGIN_UPDATER_ROUTINES );
$check->run( $check_result );

$this->assertEmpty( $check_result->get_errors() );
$this->assertEmpty( $check_result->get_warnings() );
$this->assertSame( 0, $check_result->get_warning_count() );
}

/**
* Update URI may point at this plugin’s WordPress.org URL; that must not be flagged.
*/
Expand Down
Loading