diff --git a/aspire-update.php b/aspire-update.php index 09ac602..caa44a9 100644 --- a/aspire-update.php +++ b/aspire-update.php @@ -32,4 +32,6 @@ require_once __DIR__ . '/includes/autoload.php'; -new AspireUpdate\Controller(); +if ( ! defined( 'AP_RUN_TESTS' ) ) { + new AspireUpdate\Controller(); +} diff --git a/tests/AdminSettings/AdminSettings_GetSettingTest.php b/tests/AdminSettings/AdminSettings_GetSettingTest.php index ba7d8e7..d54aed0 100644 --- a/tests/AdminSettings/AdminSettings_GetSettingTest.php +++ b/tests/AdminSettings/AdminSettings_GetSettingTest.php @@ -11,29 +11,16 @@ * @covers \AspireUpdate\Admin_Settings::get_setting */ class AdminSettings_GetSettingTest extends WP_UnitTestCase { - /** - * Shared instance of the class. - * - * @var \AspireUpdate\Admin_Settings - */ - private static $instance; - - /** - * Set up before any tests run. - */ - public static function set_up_before_class() { - self::$instance = \AspireUpdate\Admin_Settings::get_instance(); - } - /** * Test that the default 'api_host' value is retrieved. * * @covers \AspireUpdate\Admin_Settings::get_default_settings */ public function test_should_get_default_api_host() { - $actual = self::$instance->get_setting( 'api_host' ); + $admin_settings = new \AspireUpdate\Admin_Settings(); + $actual = $admin_settings->get_setting( 'api_host' ); $this->assertIsString( $actual, 'The API host value is not a string.' ); - $this->assertNotEmpty( $actual, 'The API host value is empty. ' . var_export( $actual, true ) ); + $this->assertNotEmpty( $actual, 'The API host value is empty. ' ); } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 8655d11..6daa840 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -5,6 +5,8 @@ * @package AspireUpdate */ +define( 'AP_RUN_TESTS', true ); + $_tests_dir = getenv( 'WP_TESTS_DIR' ); if ( ! $_tests_dir ) {