From 163e19f1e90b67c9b7834f7bc9484feaea5a475e Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 25 Feb 2025 10:37:06 +0000 Subject: [PATCH] Added label test Signed-off-by: snipe --- tests/Feature/Assets/Ui/AssetLabelTest.php | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 tests/Feature/Assets/Ui/AssetLabelTest.php diff --git a/tests/Feature/Assets/Ui/AssetLabelTest.php b/tests/Feature/Assets/Ui/AssetLabelTest.php new file mode 100644 index 0000000000..ddf57828bf --- /dev/null +++ b/tests/Feature/Assets/Ui/AssetLabelTest.php @@ -0,0 +1,36 @@ +count(20)->create(); + $id_array = $assets->pluck('id')->toArray(); + + $this->actingAs(User::factory()->viewAssets()->create())->post('/hardware/bulkedit', [ + 'ids' => $id_array, + 'bulk_actions' => 'labels', + ])->assertStatus(200); + } + + public function testRedirectOfNoAssetsSelected() + { + $id_array = []; + $this->actingAs(User::factory()->viewAssets()->create()) + ->from(route('hardware.index')) + ->post('/hardware/bulkedit', [ + 'ids' => $id_array, + 'bulk_actions' => 'Labels', + ])->assertStatus(302) + ->assertRedirect(route('hardware.index')); + } + +}