mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Finish implementing test
This commit is contained in:
parent
cf0ce1c5ea
commit
0190ccea27
|
@ -22,22 +22,32 @@ class CreateNotesTest extends TestCase
|
|||
$this->markTestIncomplete();
|
||||
}
|
||||
|
||||
public function testCanCreateNote()
|
||||
public function testCanCreateNoteForAsset()
|
||||
{
|
||||
// @todo: make dynamic?
|
||||
|
||||
$actor = User::factory()->editAssets()->create();
|
||||
|
||||
$asset = Asset::factory()->create();
|
||||
|
||||
$this->actingAs($actor)
|
||||
->withHeader('User-Agent', 'Custom User Agent For Test')
|
||||
->post(route('notes.store'), [
|
||||
'_token' => '_token-to-simulate-request-from-gui',
|
||||
'id' => $asset->id,
|
||||
'type' => 'asset',
|
||||
'note' => 'my special note',
|
||||
])
|
||||
->assertRedirect(route('hardware.show', $asset->id) . '#history');
|
||||
|
||||
// @todo: assert action log created with expected data
|
||||
$this->assertDatabaseHas('action_logs', [
|
||||
'created_by' => $actor->id,
|
||||
'action_type' => 'note added',
|
||||
'target_id' => null,
|
||||
'target_type' => null,
|
||||
'note' => 'my special note',
|
||||
'item_type' => Asset::class,
|
||||
'item_id' => $asset->id,
|
||||
'action_source' => 'gui',
|
||||
'user_agent' => 'Custom User Agent For Test',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue