-
Notifications
You must be signed in to change notification settings - Fork 290
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9441 from google/enhancement/9333-siwg-settings
Enhancement/9333 siwg settings
- Loading branch information
Showing
2 changed files
with
117 additions
and
10 deletions.
There are no files selected for viewing
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
47 changes: 47 additions & 0 deletions
47
tests/phpunit/integration/Modules/Sign_In_With_Google/SettingsTest.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,47 @@ | ||
<?php | ||
/** | ||
* Class Google\Site_Kit\Tests\Modules\Sign_In_With_Google\SettingsTest | ||
* | ||
* @package Google\Site_Kit\Tests\Modules\Sign_In_With_Google | ||
* @copyright 2024 Google LLC | ||
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0 | ||
* @link https://sitekit.withgoogle.com | ||
*/ | ||
|
||
namespace Google\Site_Kit\Tests\Modules\Sign_In_With_Google; | ||
|
||
use Google\Site_Kit\Context; | ||
use Google\Site_Kit\Core\Storage\Options; | ||
use Google\Site_Kit\Modules\Sign_In_With_Google\Settings; | ||
use Google\Site_Kit\Tests\Modules\SettingsTestCase; | ||
|
||
/** | ||
* @group Modules | ||
* @group Sign_In_With_Google | ||
*/ | ||
class SettingsTest extends SettingsTestCase { | ||
|
||
public function test_get_default() { | ||
$settings = new Settings( new Options( new Context( GOOGLESITEKIT_PLUGIN_MAIN_FILE ) ) ); | ||
$settings->register(); | ||
$default = get_option( Settings::OPTION ); | ||
|
||
$this->assertIsArray( $default ); | ||
$this->assertArrayHasKey( 'clientID', $default ); | ||
$this->assertArrayHasKey( 'text', $default ); | ||
$this->assertArrayHasKey( 'theme', $default ); | ||
$this->assertArrayHasKey( 'shape', $default ); | ||
|
||
$this->assertSame( '', $default['clientID'] ); | ||
$this->assertSame( Settings::TEXT_SIGN_IN_WITH_GOOGLE, $default['text'] ); | ||
$this->assertSame( Settings::THEME_LIGHT, $default['theme'] ); | ||
$this->assertSame( Settings::SHAPE_RECTANGULAR, $default['shape'] ); | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
protected function get_option_name() { | ||
return Settings::OPTION; | ||
} | ||
} |