Skip to content

A free open source IT asset/license management system

Move testing from guidelines to rules

Marcus Moore483cc2261937
diff --git a/.ai/guidelines/snipe-it-testing.md b/.ai/guidelines/snipe-it-testing.md
deleted file mode 100644
index bc754bbcb3..0000000000
--- a/.ai/guidelines/snipe-it-testing.md
+++ /dev/null
@@ -1,12 +0,0 @@
-# Snipe-IT Testing
-
-- Feature tests live in `tests/Feature/`, organized by entity (e.g. `tests/Feature/Assets/AssetsTest.php`). Unit tests live in `tests/Unit/`.
-- Feature tests hit the database. The test environment uses `array` drivers for cache, session, and mail.
-- Always build test data with model factories. Check for an existing custom state before setting attributes by hand.
-- Test methods are named in snake_case: `test_page_renders()`, `test_requires_permission()`. Never camelCase.
-- UI GET routes should have both a `test_page_renders` test and a `test_requires_permission` test.
-
-```bash
-php artisan test tests/Feature/Assets/AssetsTest.php # single file
-php artisan test --filter test_some_method # single method
-```
diff --git a/.ai/rules/tests.md b/.ai/rules/tests.md
index 6b967be128..0bbf62f662 100644
--- a/.ai/rules/tests.md
+++ b/.ai/rules/tests.md
@@ -5,11 +5,24 @@ paths:
# Tests
+## Feature and Unit test layout
+
+Feature tests live in `tests/Feature/`, organized by entity (e.g. `tests/Feature/Assets/AssetsTest.php`). Unit tests
+live in `tests/Unit/`.
+
+## Test environment uses array drivers
+
+Feature tests hit the database. The test environment uses `array` drivers for cache, session, and mail.
+
## Database refresh comes from the base TestCase
`Tests\TestCase` already applies `LazilyRefreshDatabase` and seeds settings via `InitializesSettings`. Do not add `RefreshDatabase`, `DatabaseTransactions`, or `DatabaseMigrations` to an individual test.
## Test methods are snake_case
Name test methods in snake_case: `test_page_renders()`, `test_requires_permission()`. Never camelCase.
+## UI GET routes need a render and a permission test
+
+Every UI GET route should have both a `test_page_renders` test and a `test_requires_permission` test.
+
## Authenticate API tests with actingAsForApi()
Use `$this->actingAsForApi($user)` in API tests and `$this->actingAs($user)` in UI tests.
diff --git a/AGENTS.md b/AGENTS.md
index 81f2e938ec..a57319864d 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -105,23 +105,6 @@ php artisan optimize:clear
herd coverage
```
-=== .ai/snipe-it-testing rules ===
-
-# Snipe-IT Testing
-
-- Feature tests live in `tests/Feature/`, organized by entity (e.g. `tests/Feature/Assets/AssetsTest.php`). Unit tests live in `tests/Unit/`.
-- Feature tests hit the database. The test environment uses `array` drivers for cache, session, and mail.
-- Always build test data with model factories. Check for an existing custom state before setting attributes by hand.
-- Test methods are named in snake_case: `test_page_renders()`, `test_requires_permission()`. Never camelCase.
-- UI GET routes should have both a `test_page_renders` test and a `test_requires_permission` test.
-
-```bash
-php artisan test tests/Feature/Assets/AssetsTest.php # single file
-
-php artisan test --filter test_some_method # single method
-
-```
-
=== foundation rules ===
# Laravel Boost Guidelines
@@ -136,10 +119,6 @@ Before relying on a package's API, confirm its installed version:
- PHP packages: run `composer show --direct` to list direct dependencies with versions, or `composer show <vendor/package>` for a single package.
- JS packages: check `package.json` for the installed versions.
-## Skills Activation
-
-This project has domain-specific skills available in `**/skills/**`. You MUST activate the relevant skill whenever you work in that domain—don't wait until you're stuck.
-
## Conventions
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, and naming.
diff --git a/CLAUDE.md b/CLAUDE.md
index 81f2e938ec..a57319864d 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -105,23 +105,6 @@ php artisan optimize:clear
herd coverage
```
-=== .ai/snipe-it-testing rules ===
-
-# Snipe-IT Testing
-
-- Feature tests live in `tests/Feature/`, organized by entity (e.g. `tests/Feature/Assets/AssetsTest.php`). Unit tests live in `tests/Unit/`.
-- Feature tests hit the database. The test environment uses `array` drivers for cache, session, and mail.
-- Always build test data with model factories. Check for an existing custom state before setting attributes by hand.
-- Test methods are named in snake_case: `test_page_renders()`, `test_requires_permission()`. Never camelCase.
-- UI GET routes should have both a `test_page_renders` test and a `test_requires_permission` test.
-
-```bash
-php artisan test tests/Feature/Assets/AssetsTest.php # single file
-
-php artisan test --filter test_some_method # single method
-
-```
-
=== foundation rules ===
# Laravel Boost Guidelines
@@ -136,10 +119,6 @@ Before relying on a package's API, confirm its installed version:
- PHP packages: run `composer show --direct` to list direct dependencies with versions, or `composer show <vendor/package>` for a single package.
- JS packages: check `package.json` for the installed versions.
-## Skills Activation
-
-This project has domain-specific skills available in `**/skills/**`. You MUST activate the relevant skill whenever you work in that domain—don't wait until you're stuck.
-
## Conventions
- You must follow all existing code conventions used in this application. When creating or editing a file, check sibling files for the correct structure, approach, and naming.