snipe-it/tests/Feature/Notes/CreateNotesTest.php

44 lines
993 B
PHP
Raw Normal View History

2025-02-18 16:16:00 -08:00
<?php
namespace Tests\Feature\Notes;
2025-02-18 16:24:52 -08:00
use App\Models\Asset;
use App\Models\User;
2025-02-18 16:16:00 -08:00
use Tests\TestCase;
class CreateNotesTest extends TestCase
{
public function testRequiresPermission()
{
$this->markTestIncomplete();
2025-02-18 16:24:52 -08:00
$this->actingAs(User::factory()->create())
->post(route('notes.store'))
->assertForbidden();
2025-02-18 16:16:00 -08:00
}
public function testValidation()
{
$this->markTestIncomplete();
}
public function testCanCreateNote()
{
2025-02-18 16:24:52 -08:00
// @todo: make dynamic?
$actor = User::factory()->editAssets()->create();
$asset = Asset::factory()->create();
$this->actingAs($actor)
->post(route('notes.store'), [
'id' => $asset->id,
'type' => 'asset',
'note' => 'my special note',
])
->assertRedirect(route('hardware.show', $asset->id) . '#history');
// @todo: assert action log created with expected data
2025-02-18 16:16:00 -08:00
}
}