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

feat: remove functionality that disabled updates via the dashboard fo… #2963

Merged
merged 3 commits into from
Apr 10, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 3 additions & 6 deletions lib/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ protected static function update_message_milestone() {
*/
protected static function update_message_major() {
$m = '<br><b>Warning:</b> This new version of Timber introduces some major new features which might have unknown effects on your site.';


$m .= self::disable_update();
return $m;
}

Expand Down Expand Up @@ -118,16 +115,16 @@ public static function in_plugin_update_message( $plugin_data, $r ) {
$upgrade_magnitude = self::get_upgrade_magnitude($current_version, $new_version);
if ( $upgrade_magnitude == 'milestone' ) {
$message = self::update_message_milestone();
echo '<br />'.sprintf($message);
echo '<br />' . ($message);
return;
} elseif ( $upgrade_magnitude == 'major' ) {
//major version
$message = self::update_message_major();
echo '<br />'.sprintf($message);
echo '<br />' . ($message);
return;
}
$message = self::update_message_minor();
echo '<br />'.($message);
echo '<br />' . ($message);
return;

}
Expand Down
12 changes: 12 additions & 0 deletions tests/Timber_UnitTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,16 @@ protected function callMethod($obj, $name, array $args = [])
$method->setAccessible(true);
return $method->invokeArgs($obj, $args);
}

public function isWordPressVersion(string $version, string $operator = '=')
{
return version_compare($GLOBALS['wp_version'], $version, $operator);
}

public function skipForWordpressVersion(string $version, string $operator = '<')
{
if ($this->isWordPressVersion($version, $operator)) {
$this->markTestSkipped("This test requires WordPress version $version or higher.");
}
}
}
24 changes: 24 additions & 0 deletions tests/test-timber-wp-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ function testFunctionFire(){
}

function testFooterOnFooterFW(){
if ($this->isWordPressVersion('6.4', '>=')) {
$this->setExpectedDeprecated('the_block_template_skip_link');
}

global $wp_scripts;
$wp_scripts = null;
wp_enqueue_script( 'jquery', false, array(), false, true );
Expand All @@ -26,6 +30,10 @@ function testFooterOnFooterFW(){
}

function testFooterAlone(){
if ($this->isWordPressVersion('6.4', '>=')) {
$this->setExpectedDeprecated('the_block_template_skip_link');
}

global $wp_scripts;
$wp_scripts = null;
wp_enqueue_script( 'jquery', false, array(), false, true );
Expand All @@ -44,6 +52,10 @@ function testDoubleAction(){
}

function testDoubleActionWPFooter(){
if ($this->isWordPressVersion('6.4', '>=')) {
$this->setExpectedDeprecated('the_block_template_skip_link');
}

global $wp_scripts;
$wp_scripts = null;
add_action('wp_footer', 'echo_junk');
Expand All @@ -55,6 +67,10 @@ function testDoubleActionWPFooter(){
}

function testInTwig(){
if ($this->isWordPressVersion('6.4', '>=')) {
$this->setExpectedDeprecated('the_block_template_skip_link');
}

global $wp_scripts;
$wp_scripts = null;
wp_enqueue_script( 'jquery', false, array(), false, true );
Expand All @@ -63,6 +79,10 @@ function testInTwig(){
}

function testInTwigString(){
if ($this->isWordPressVersion('6.4', '>=')) {
$this->setExpectedDeprecated('the_block_template_skip_link');
}

global $wp_scripts;
$wp_scripts = null;
wp_enqueue_script( 'jquery', false, array(), false, true );
Expand All @@ -71,6 +91,10 @@ function testInTwigString(){
}

function testAgainstFooterFunctionOutput(){
if ($this->isWordPressVersion('6.4', '>=')) {
$this->setExpectedDeprecated('the_block_template_skip_link');
}

global $wp_scripts;
$wp_scripts = null;
wp_enqueue_script( 'colorpicker', false, array(), false, true);
Expand Down