3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-04-05 15:28:30 +00:00
Files
snipe-it/tests/Feature/Groups/Ui/CreateGroupTest.php
2026-03-16 17:40:57 -07:00

32 lines
830 B
PHP

<?php
namespace Tests\Feature\Groups\Ui;
use App\Models\Group;
use App\Models\User;
use Tests\TestCase;
class CreateGroupTest extends TestCase
{
public function test_page_renders()
{
$this->actingAs(User::factory()->superuser()->create())
->get(route('groups.create'))
->assertOk();
}
public function test_user_can_create_group()
{
$this->assertFalse(Group::where('name', 'Test Group')->exists());
$this->actingAs(User::factory()->superuser()->create())
->post(route('groups.store'), [
'name' => 'Test Group',
'notes' => 'Test Note',
])
->assertRedirect(route('groups.index'));
$this->assertTrue(Group::where('name', 'Test Group')->where('notes', 'Test Note')->exists());
}
}