first commit

This commit is contained in:
2025-09-01 15:06:58 +02:00
commit d8b89fc4fe
5702 changed files with 1021992 additions and 0 deletions
@@ -0,0 +1,38 @@
<?php
namespace Tests\Feature\Api;
use Facades\Tests\Setup\UserFactory;
use Setting;
use Tests\Feature\ApiTestCase;
use Vanguard\User;
class SettingsControllerTest extends ApiTestCase
{
/** @test */
public function only_authenticated_users_can_view_app_settings()
{
$this->getJson('/api/settings')->assertStatus(401);
}
/** @test */
public function get_settings_without_permission()
{
$user = User::factory()->create();
$this->actingAs($user, self::API_GUARD)
->getJson('/api/settings')
->assertStatus(403);
}
/** @test */
public function get_settings()
{
$user = UserFactory::withPermissions('settings.general')->create();
$this->actingAs($user, self::API_GUARD)
->getJson("/api/settings")
->assertOk()
->assertJson(Setting::all());
}
}