diff --git a/inc/functions.php b/inc/functions.php new file mode 100644 index 0000000..bfd789d --- /dev/null +++ b/inc/functions.php @@ -0,0 +1,18 @@ +your Pantheon dashboard.', 'pantheon-systems' ), 'https://dashboard.pantheon.io/sites/' . $_ENV['PANTHEON_SITE'] ); @@ -159,7 +149,7 @@ function _pantheon_register_upstream_update_notice() { * @return object */ function _pantheon_disable_wp_updates(): object { - $wp_version = _pantheon_get_current_wordpress_version(); + $wp_version = Pantheon\_pantheon_get_current_wordpress_version(); return (object) [ 'updates' => [], 'version_checked' => $wp_version, // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable diff --git a/pantheon.php b/pantheon.php index 940e5a1..d00cef6 100644 --- a/pantheon.php +++ b/pantheon.php @@ -3,23 +3,23 @@ * Plugin Name: Pantheon * Plugin URI: https://pantheon.io/ * Description: Building on Pantheon's and WordPress's strengths, together. - * Version: 1.2.1 + * Version: 1.3.1 * Author: Pantheon * Author URI: https://pantheon.io/ * * @package pantheon */ -define( 'PANTHEON_MU_PLUGIN_VERSION', '1.2.1' ); +define( 'PANTHEON_MU_PLUGIN_VERSION', '1.3.1' ); if ( isset( $_ENV['PANTHEON_ENVIRONMENT'] ) ) { - + require_once 'inc/functions.php'; require_once 'inc/pantheon-page-cache.php'; if ( ! defined( 'DISABLE_PANTHEON_UPDATE_NOTICES' ) || ! DISABLE_PANTHEON_UPDATE_NOTICES ) { require_once 'inc/pantheon-updates.php'; } // If the WP Font Library exists, we can add our font directory modifications. Use version_compare because the Font Library isn't actually loaded yet. - if ( version_compare( _pantheon_get_current_wordpress_version(), '6.5' ) ) { + if ( version_compare( Pantheon\_pantheon_get_current_wordpress_version(), '6.5' ) ) { require_once 'inc/fonts.php'; } if ( ! defined( 'RETURN_TO_PANTHEON_BUTTON' ) || RETURN_TO_PANTHEON_BUTTON ) { diff --git a/tests/phpunit/test-main.php b/tests/phpunit/test-main.php index afb9173..60a63c2 100644 --- a/tests/phpunit/test-main.php +++ b/tests/phpunit/test-main.php @@ -14,7 +14,6 @@ class Test_Main extends WP_UnitTestCase { */ public function test_mu_plugin_constants() { $this->assertTrue( defined( 'PANTHEON_MU_PLUGIN_VERSION' ) ); - $this->assertEquals( '1.2.1', PANTHEON_MU_PLUGIN_VERSION ); $this->assertTrue( defined( 'FS_METHOD' ) ); $this->assertEquals( 'direct', FS_METHOD ); @@ -26,4 +25,13 @@ public function test_mu_plugin_constants() { $this->assertTrue( MULTISITE ); } } + + /** + * Test that _pantheon_get_current_wordpress_version is available. + */ + public function test_get_current_wp_version_exists() { + // Check _pantheon_get_current_wordpress_version() is defined. + $this->assertTrue( function_exists( 'Pantheon\\_pantheon_get_current_wordpress_version' ) ); + $this->assertIsString( Pantheon\_pantheon_get_current_wordpress_version() ); + } } diff --git a/tests/phpunit/test-pantheon-updates.php b/tests/phpunit/test-pantheon-updates.php index a703c4e..03ef170 100644 --- a/tests/phpunit/test-pantheon-updates.php +++ b/tests/phpunit/test-pantheon-updates.php @@ -21,7 +21,7 @@ class Test_Pantheon_Updates extends WP_UnitTestCase { */ public function __construct() { parent::__construct(); - self::$wp_version = _pantheon_get_current_wordpress_version(); + self::$wp_version = Pantheon\_pantheon_get_current_wordpress_version(); } /** @@ -64,7 +64,7 @@ public function test_pantheon_hide_update_nag() { */ public function test_pantheon_get_current_wordpress_version() { // Run the function. - $result = _pantheon_get_current_wordpress_version(); + $result = Pantheon\_pantheon_get_current_wordpress_version(); $current_version = self::get_latest_wp_version_from_file(); // If the current version is greater than the result, then we downloaded a nightly version for testing. @@ -179,7 +179,7 @@ private static function get_next_beta_version() { * Check if we're using a beta version. */ private static function is_prerelease() { - $current_version = _pantheon_get_current_wordpress_version(); + $current_version = Pantheon\_pantheon_get_current_wordpress_version(); $installed_version = self::get_latest_wp_version_from_file(); // If the current version and the installed version are the same, then we're not using a prerelease.