first commit
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user