Surface Gitea settings via projects_portfolio_settings() and test

This commit is contained in:
Keith Solomon
2026-08-09 23:12:37 -05:00
parent 925ef184b9
commit e60a9eafb3
2 changed files with 36 additions and 2 deletions
+32
View File
@@ -0,0 +1,32 @@
<?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'] );
}
}