-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for
Admin_Settings::delete_all_settings()
. (#232)
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
tests/phpunit/tests/AdminSettings/AdminSettings_DeleteAllSettingsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Class AdminSettings_DeleteAllSettingsTest | ||
* | ||
* @package AspireUpdate | ||
*/ | ||
|
||
/** | ||
* Tests for Admin_Settings::delete_all_settings() | ||
* | ||
* @covers \AspireUpdate\Admin_Settings::delete_all_settings | ||
*/ | ||
class AdminSettings_DeleteAllSettingsTest extends AdminSettings_UnitTestCase { | ||
/** | ||
* Test that all settings are deleted. | ||
*/ | ||
public function test_should_delete_all_settings() { | ||
$settings = [ | ||
'enable' => true, | ||
'api_host' => 'the.api.host', | ||
'api_key' => 'tHeApIkEy', | ||
'enable_debug' => true, | ||
'enable_debug_types' => [ 'response' => true ], | ||
'disable_ssl_verification' => true, | ||
]; | ||
|
||
$this->assertTrue( | ||
update_site_option( self::$option_name, $settings ), | ||
'Settings were not set before the test.' | ||
); | ||
|
||
$admin_settings = new \AspireUpdate\Admin_Settings(); | ||
|
||
$admin_settings->delete_all_settings(); | ||
$this->assertFalse( | ||
get_site_option( self::$option_name, false ), | ||
'Settings were not deleted.' | ||
); | ||
} | ||
} |