Skip to content

A free open source IT asset/license management system

Use test annotation

Marcus Mooref2dfa22d613a
diff --git a/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php b/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php
index 03ef269d43..812445b462 100644
--- a/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php
+++ b/tests/Feature/Checkins/Ui/AccessoryCheckinTest.php
@@ -13,11 +13,13 @@ use App\Notifications\CheckinAccessoryNotification;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Notification;
+use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class AccessoryCheckinTest extends TestCase
{
- public function test_checking_in_accessory_requires_correct_permission()
+ #[Test]
+ public function checking_in_accessory_requires_correct_permission()
{
$accessory = Accessory::factory()->checkedOutToUser()->create();
@@ -26,7 +28,8 @@ class AccessoryCheckinTest extends TestCase
->assertForbidden();
}
- public function test_page_renders()
+ #[Test]
+ public function page_renders()
{
$accessory = Accessory::factory()->checkedOutToUser()->create();
@@ -35,7 +38,8 @@ class AccessoryCheckinTest extends TestCase
->assertOk();
}
- public function test_accessory_can_be_checked_in()
+ #[Test]
+ public function accessory_can_be_checked_in()
{
Event::fake([CheckoutableCheckedIn::class]);
@@ -52,7 +56,8 @@ class AccessoryCheckinTest extends TestCase
Event::assertDispatched(CheckoutableCheckedIn::class, 1);
}
- public function test_email_sent_to_user_if_setting_enabled()
+ #[Test]
+ public function email_sent_to_user_if_setting_enabled()
{
Mail::fake();
@@ -73,7 +78,8 @@ class AccessoryCheckinTest extends TestCase
});
}
- public function test_email_not_sent_to_user_if_setting_disabled()
+ #[Test]
+ public function email_not_sent_to_user_if_setting_disabled()
{
Mail::fake();
@@ -98,7 +104,8 @@ class AccessoryCheckinTest extends TestCase
});
}
- public function test_accessory_checkin_clears_pending_acceptance_when_notifications_are_fully_disabled()
+ #[Test]
+ public function accessory_checkin_clears_pending_acceptance_when_notifications_are_fully_disabled()
{
$this->settings->disableAdminCC()->disableAdminCCAlways()->disableSlackWebhook();
@@ -126,7 +133,8 @@ class AccessoryCheckinTest extends TestCase
);
}
- public function test_accessory_checkin_clears_pending_acceptance_when_only_a_webhook_is_configured()
+ #[Test]
+ public function accessory_checkin_clears_pending_acceptance_when_only_a_webhook_is_configured()
{
Notification::fake();
@@ -157,7 +165,8 @@ class AccessoryCheckinTest extends TestCase
);
}
- public function test_accessory_checkin_does_not_clear_a_same_id_pending_acceptance_of_another_type()
+ #[Test]
+ public function accessory_checkin_does_not_clear_a_same_id_pending_acceptance_of_another_type()
{
Mail::fake();
diff --git a/tests/Feature/Checkins/Ui/LicenseCheckinTest.php b/tests/Feature/Checkins/Ui/LicenseCheckinTest.php
index 31458a2f60..ed27e15684 100644
--- a/tests/Feature/Checkins/Ui/LicenseCheckinTest.php
+++ b/tests/Feature/Checkins/Ui/LicenseCheckinTest.php
@@ -15,11 +15,13 @@ use App\Notifications\CheckinLicenseSeatNotification;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Notification;
+use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class LicenseCheckinTest extends TestCase
{
- public function test_checking_in_license_requires_correct_permission()
+ #[Test]
+ public function checking_in_license_requires_correct_permission()
{
$this->actingAs(User::factory()->create())
->post(route('licenses.checkin.save', [
@@ -28,7 +30,8 @@ class LicenseCheckinTest extends TestCase
->assertForbidden();
}
- public function test_non_reassignable_seat_remains_unreassignable_after_checkin()
+ #[Test]
+ public function non_reassignable_seat_remains_unreassignable_after_checkin()
{
$licenseSeat = LicenseSeat::factory()
->notReassignable()
@@ -43,7 +46,8 @@ class LicenseCheckinTest extends TestCase
$this->assertEquals(true, $licenseSeat->unreassignable_seat);
}
- public function test_cannot_checkin_license_that_is_not_assigned()
+ #[Test]
+ public function cannot_checkin_license_that_is_not_assigned()
{
$licenseSeat = LicenseSeat::factory()
->reassignable()
@@ -60,7 +64,8 @@ class LicenseCheckinTest extends TestCase
->assertSessionHas('error', trans('admin/licenses/message.checkin.error'));
}
- public function test_can_check_in_license_assigned_to_asset()
+ #[Test]
+ public function can_check_in_license_assigned_to_asset()
{
Event::fake([CheckoutableCheckedIn::class]);
@@ -93,7 +98,8 @@ class LicenseCheckinTest extends TestCase
});
}
- public function test_can_check_in_license_assigned_to_user()
+ #[Test]
+ public function can_check_in_license_assigned_to_user()
{
Event::fake([CheckoutableCheckedIn::class]);
@@ -127,7 +133,8 @@ class LicenseCheckinTest extends TestCase
}
- public function test_page_renders()
+ #[Test]
+ public function page_renders()
{
$this->actingAs(User::factory()->superuser()->create())
->get(route('licenses.checkin', LicenseSeat::factory()->assignedToUser()->create()->id))
@@ -135,7 +142,8 @@ class LicenseCheckinTest extends TestCase
}
- public function test_license_seat_checkin_clears_pending_acceptance_when_notifications_are_fully_disabled()
+ #[Test]
+ public function license_seat_checkin_clears_pending_acceptance_when_notifications_are_fully_disabled()
{
$this->settings->disableAdminCC()->disableAdminCCAlways()->disableSlackWebhook();
@@ -154,7 +162,8 @@ class LicenseCheckinTest extends TestCase
);
}
- public function test_license_seat_checkin_clears_pending_acceptance_when_only_a_webhook_is_configured()
+ #[Test]
+ public function license_seat_checkin_clears_pending_acceptance_when_only_a_webhook_is_configured()
{
Notification::fake();
@@ -175,7 +184,8 @@ class LicenseCheckinTest extends TestCase
);
}
- public function test_license_seat_checkin_does_not_clear_a_same_id_pending_acceptance_of_another_type()
+ #[Test]
+ public function license_seat_checkin_does_not_clear_a_same_id_pending_acceptance_of_another_type()
{
Mail::fake();
diff --git a/tests/Feature/Users/TransferUserItemsAcceptanceCleanupTest.php b/tests/Feature/Users/TransferUserItemsAcceptanceCleanupTest.php
index 557b4ac9dc..6ad8ef86a1 100644
--- a/tests/Feature/Users/TransferUserItemsAcceptanceCleanupTest.php
+++ b/tests/Feature/Users/TransferUserItemsAcceptanceCleanupTest.php
@@ -10,6 +10,7 @@ use App\Models\CheckoutAcceptance;
use App\Models\License;
use App\Models\LicenseSeat;
use App\Models\User;
+use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class TransferUserItemsAcceptanceCleanupTest extends TestCase
@@ -26,7 +27,8 @@ class TransferUserItemsAcceptanceCleanupTest extends TestCase
->disableAdminCCAlways();
}
- public function test_transferring_license_seat_clears_source_users_pending_acceptance_for_that_seat(): void
+ #[Test]
+ public function transferring_license_seat_clears_source_users_pending_acceptance_for_that_seat(): void
{
$source = User::factory()->create();
$target = User::factory()->create();
@@ -57,7 +59,8 @@ class TransferUserItemsAcceptanceCleanupTest extends TestCase
$this->assertAcceptanceWasSoftDeleted($acceptance);
}
- public function test_transferring_license_seat_leaves_pending_acceptance_for_another_seat_of_the_same_license_alone(): void
+ #[Test]
+ public function transferring_license_seat_leaves_pending_acceptance_for_another_seat_of_the_same_license_alone(): void
{
$source = User::factory()->create();
$target = User::factory()->create();
@@ -88,7 +91,8 @@ class TransferUserItemsAcceptanceCleanupTest extends TestCase
$this->assertAcceptanceSurvived($retainedAcceptance);
}
- public function test_transferring_accessory_clears_only_the_source_users_pending_acceptance(): void
+ #[Test]
+ public function transferring_accessory_clears_only_the_source_users_pending_acceptance(): void
{
$source = User::factory()->create();
$target = User::factory()->create();
@@ -128,7 +132,8 @@ class TransferUserItemsAcceptanceCleanupTest extends TestCase
$this->assertAcceptanceSurvived($otherHolderAcceptance);
}
- public function test_transferring_asset_clears_source_users_pending_acceptance(): void
+ #[Test]
+ public function transferring_asset_clears_source_users_pending_acceptance(): void
{
$source = User::factory()->create();
$target = User::factory()->create();