forked from Solo-Web-Works/Projects-Portfolio
33 lines
1.0 KiB
PHP
33 lines
1.0 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../includes/helper-functions.php';
|
|
|
|
/**
|
|
* @covers \projects_portfolio_settings
|
|
*/
|
|
class Settings_Test extends \PHPUnit\Framework\TestCase {
|
|
|
|
protected function setUp(): void {
|
|
\Brain\Monkey\setUp();
|
|
}
|
|
|
|
protected function tearDown(): void {
|
|
\Brain\Monkey\tearDown();
|
|
}
|
|
|
|
public function test_settings_aggregator_includes_gitea_keys(): void {
|
|
\Brain\Monkey\Functions\stubs( [
|
|
'get_option' => function ( $key, $default = '' ) {
|
|
$values = [
|
|
'projects_portfolio_default_gitea_base_url' => 'https://git.example.org',
|
|
'projects_portfolio_gitea_api_token' => 'secret',
|
|
];
|
|
return $values[ $key ] ?? $default;
|
|
},
|
|
] );
|
|
|
|
$settings = projects_portfolio_settings();
|
|
$this->assertSame( 'https://git.example.org', $settings['default_gitea_base_url'] );
|
|
$this->assertSame( 'secret', $settings['gitea_api_token'] );
|
|
}
|
|
}
|