Skip to content

Commit

Permalink
Use a new object for testing Admin_Settings::get_setting().
Browse files Browse the repository at this point in the history
  • Loading branch information
costdev committed Nov 1, 2024
1 parent 7c708d8 commit 151f36a
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions tests/AdminSettings/AdminSettings_GetSettingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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. ' );
}
}

0 comments on commit 151f36a

Please sign in to comment.