From ecfa7505718e2da89f824906c47bed7e80ffba7c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Dec 2025 16:02:54 +0000 Subject: [PATCH 1/3] Initial plan From a0f8e24b59808e0e3cc972df6fc9306741449588 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 29 Dec 2025 16:14:47 +0000 Subject: [PATCH 2/3] Fix missing Tests\TestCase class for PHPUnit tests Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com> --- tests/CreatesApplication.php | 18 ++++++++++++++++++ tests/TestCase.php | 10 ++++++++++ 2 files changed, 28 insertions(+) create mode 100644 tests/CreatesApplication.php create mode 100644 tests/TestCase.php diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php new file mode 100644 index 000000000..c1f336fd4 --- /dev/null +++ b/tests/CreatesApplication.php @@ -0,0 +1,18 @@ +make(Kernel::class)->bootstrap(); + + return $app; + } +} diff --git a/tests/TestCase.php b/tests/TestCase.php new file mode 100644 index 000000000..2932d4a69 --- /dev/null +++ b/tests/TestCase.php @@ -0,0 +1,10 @@ + Date: Mon, 29 Dec 2025 16:28:36 +0000 Subject: [PATCH 3/3] Refactor tests to extend AbstractTestCase instead of Tests\TestCase Co-authored-by: nielsdrost7 <47660417+nielsdrost7@users.noreply.github.com> --- .github/copilot-instructions.md | 4 ++++ .junie/guidelines.md | 4 ++++ .../Tests/Feature/NumberingPanelAccessTest.php | 4 ++-- .../NumberGeneratorTemplateTest.php | 4 ++-- .../Services/NumberingCompanyIsolationTest.php | 4 ++-- .../InvoiceDuplicateNumberPreventionTest.php | 4 ++-- .../InvoiceNumberingSchemeChangeTest.php | 4 ++-- .../QuoteDuplicateNumberPreventionTest.php | 4 ++-- tests/CreatesApplication.php | 18 ------------------ tests/TestCase.php | 10 ---------- 10 files changed, 20 insertions(+), 40 deletions(-) delete mode 100644 tests/CreatesApplication.php delete mode 100644 tests/TestCase.php diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 3714c41e0..1679aae3b 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -134,6 +134,10 @@ php artisan queue:work - Tests have inline comment blocks above sections (/* Arrange */, /* Act */, /* Assert */). - Tests must be meaningful - avoid simple "ok" checks; validate actual behavior and data. - Use data providers for testing multiple scenarios with the same logic. + - **NEVER extend `Tests\TestCase`** - all tests must extend one of the abstract test cases from `Modules/Core/Tests/`: + - `AbstractTestCase` - Basic test case with application bootstrap + - `AbstractAdminPanelTestCase` - For admin panel tests with RefreshDatabase + - `AbstractCompanyPanelTestCase` - For company panel tests with multi-tenancy ### Export System Rules diff --git a/.junie/guidelines.md b/.junie/guidelines.md index c73466b35..7bcd817a9 100644 --- a/.junie/guidelines.md +++ b/.junie/guidelines.md @@ -183,6 +183,10 @@ class InvoiceServiceTest extends AbstractCompanyPanelTestCase 4. **Happy Paths Last:** Place success scenarios at the end 5. **Reusable Setup:** Abstract test cases for fixtures, not inline 6. **Comment Blocks:** Use `/* Arrange */`, `/* Act */`, `/* Assert */` +7. **NEVER extend `Tests\TestCase`:** All tests must extend one of the abstract test cases from `Modules/Core/Tests/`: + - `AbstractTestCase` - Basic test case with application bootstrap + - `AbstractAdminPanelTestCase` - For admin panel tests with RefreshDatabase + - `AbstractCompanyPanelTestCase` - For company panel tests with multi-tenancy ### Export Testing ```php diff --git a/Modules/Core/Tests/Feature/NumberingPanelAccessTest.php b/Modules/Core/Tests/Feature/NumberingPanelAccessTest.php index 8d8bf5322..88ffa8ad2 100644 --- a/Modules/Core/Tests/Feature/NumberingPanelAccessTest.php +++ b/Modules/Core/Tests/Feature/NumberingPanelAccessTest.php @@ -6,10 +6,10 @@ use Modules\Core\Models\Numbering; use Modules\Core\Models\User; use Modules\Core\Services\NumberingService; +use Modules\Core\Tests\AbstractTestCase; use PHPUnit\Framework\Attributes\Test; -use Tests\TestCase; -class NumberingPanelAccessTest extends TestCase +class NumberingPanelAccessTest extends AbstractTestCase { private NumberingService $service; diff --git a/Modules/Core/Tests/Unit/NumberGenerator/NumberGeneratorTemplateTest.php b/Modules/Core/Tests/Unit/NumberGenerator/NumberGeneratorTemplateTest.php index 4714105c3..7abb9827b 100644 --- a/Modules/Core/Tests/Unit/NumberGenerator/NumberGeneratorTemplateTest.php +++ b/Modules/Core/Tests/Unit/NumberGenerator/NumberGeneratorTemplateTest.php @@ -7,12 +7,12 @@ use Modules\Core\Enums\NumberingType; use Modules\Core\Models\Company; use Modules\Core\Models\Numbering; +use Modules\Core\Tests\AbstractTestCase; use Modules\Projects\Support\ProjectNumberGenerator; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Test; -use Tests\TestCase; -class NumberGeneratorTemplateTest extends TestCase +class NumberGeneratorTemplateTest extends AbstractTestCase { use RefreshDatabase; diff --git a/Modules/Core/Tests/Unit/Services/NumberingCompanyIsolationTest.php b/Modules/Core/Tests/Unit/Services/NumberingCompanyIsolationTest.php index 641b8091f..b80fe06ba 100644 --- a/Modules/Core/Tests/Unit/Services/NumberingCompanyIsolationTest.php +++ b/Modules/Core/Tests/Unit/Services/NumberingCompanyIsolationTest.php @@ -8,14 +8,14 @@ use Modules\Core\Models\Company; use Modules\Core\Models\Numbering; use Modules\Core\Services\NumberingService; +use Modules\Core\Tests\AbstractTestCase; use Modules\Expenses\Support\ExpenseNumberGenerator; use Modules\Projects\Models\Task; use Modules\Projects\Support\TaskNumberGenerator; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Test; -use Tests\TestCase; -class NumberingCompanyIsolationTest extends TestCase +class NumberingCompanyIsolationTest extends AbstractTestCase { use RefreshDatabase; diff --git a/Modules/Invoices/Tests/Feature/InvoiceDuplicateNumberPreventionTest.php b/Modules/Invoices/Tests/Feature/InvoiceDuplicateNumberPreventionTest.php index 9461584cb..d186ab3aa 100644 --- a/Modules/Invoices/Tests/Feature/InvoiceDuplicateNumberPreventionTest.php +++ b/Modules/Invoices/Tests/Feature/InvoiceDuplicateNumberPreventionTest.php @@ -4,12 +4,12 @@ use Modules\Core\Models\Company; use Modules\Core\Models\Numbering; +use Modules\Core\Tests\AbstractTestCase; use Modules\Invoices\Models\Invoice; use PHPUnit\Framework\Attributes\Test; use RuntimeException; -use Tests\TestCase; -class InvoiceDuplicateNumberPreventionTest extends TestCase +class InvoiceDuplicateNumberPreventionTest extends AbstractTestCase { #[Test] public function it_prevents_duplicate_invoice_numbers_within_same_company(): void diff --git a/Modules/Invoices/Tests/Feature/InvoiceNumberingSchemeChangeTest.php b/Modules/Invoices/Tests/Feature/InvoiceNumberingSchemeChangeTest.php index 42a9bb6a0..9fc1eea37 100644 --- a/Modules/Invoices/Tests/Feature/InvoiceNumberingSchemeChangeTest.php +++ b/Modules/Invoices/Tests/Feature/InvoiceNumberingSchemeChangeTest.php @@ -4,12 +4,12 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Modules\Core\Models\Numbering; +use Modules\Core\Tests\AbstractTestCase; use Modules\Invoices\Models\Invoice; use Modules\Invoices\Support\InvoiceNumberGenerator; use PHPUnit\Framework\Attributes\Test; -use Tests\TestCase; -class InvoiceNumberingSchemeChangeTest extends TestCase +class InvoiceNumberingSchemeChangeTest extends AbstractTestCase { use RefreshDatabase; diff --git a/Modules/Quotes/Tests/Feature/QuoteDuplicateNumberPreventionTest.php b/Modules/Quotes/Tests/Feature/QuoteDuplicateNumberPreventionTest.php index b31202ff8..37f51b28f 100644 --- a/Modules/Quotes/Tests/Feature/QuoteDuplicateNumberPreventionTest.php +++ b/Modules/Quotes/Tests/Feature/QuoteDuplicateNumberPreventionTest.php @@ -4,12 +4,12 @@ use Modules\Core\Models\Company; use Modules\Core\Models\Numbering; +use Modules\Core\Tests\AbstractTestCase; use Modules\Quotes\Models\Quote; use PHPUnit\Framework\Attributes\Test; use RuntimeException; -use Tests\TestCase; -class QuoteDuplicateNumberPreventionTest extends TestCase +class QuoteDuplicateNumberPreventionTest extends AbstractTestCase { #[Test] public function it_prevents_duplicate_quote_numbers_within_same_company(): void diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php deleted file mode 100644 index c1f336fd4..000000000 --- a/tests/CreatesApplication.php +++ /dev/null @@ -1,18 +0,0 @@ -make(Kernel::class)->bootstrap(); - - return $app; - } -} diff --git a/tests/TestCase.php b/tests/TestCase.php deleted file mode 100644 index 2932d4a69..000000000 --- a/tests/TestCase.php +++ /dev/null @@ -1,10 +0,0 @@ -