update controllers logic

This commit is contained in:
root
2026-04-23 00:04:35 -04:00
parent 1977a513df
commit ca4ba272fc
353 changed files with 13402 additions and 1301 deletions
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace Tests\Unit;
use App\Models\User;
use App\Services\ApplicationUrlService;
use App\Services\Docs\ApiDocsService;
use PHPUnit\Framework\TestCase;
class ApiDocsServiceTest extends TestCase
{
private function docsService(): ApiDocsService
{
$urls = $this->createMock(ApplicationUrlService::class);
$urls->method('docsSwaggerMergedJsonUrl')->with(false)->willReturn('/api/documentation/swagger.json');
return new ApiDocsService($urls);
}
public function test_public_bootstrap_matches_ci_public_flags(): void
{
$svc = $this->docsService();
$b = $svc->bootstrap(null, true);
$this->assertFalse($b['try_it_out_enabled']);
$this->assertFalse($b['persist_authorization']);
$this->assertFalse($b['show_authorize_button']);
$this->assertSame('public', $b['variant']);
$this->assertNull($b['welcome_name']);
}
public function test_full_bootstrap_enables_try_and_welcome(): void
{
$user = new User([
'firstname' => 'A',
'lastname' => 'B',
'email' => 'x@y.z',
]);
$svc = $this->docsService();
$b = $svc->bootstrap($user, false);
$this->assertTrue($b['try_it_out_enabled']);
$this->assertTrue($b['persist_authorization']);
$this->assertTrue($b['show_authorize_button']);
$this->assertSame('full', $b['variant']);
$this->assertSame('A B', $b['welcome_name']);
}
}