diff --git a/tests/Feature/Http/AddressTest.php b/tests/Feature/Http/AddressTest.php index 22c7d93..56ac06b 100644 --- a/tests/Feature/Http/AddressTest.php +++ b/tests/Feature/Http/AddressTest.php @@ -4,6 +4,7 @@ use Creasi\Base\Database\Models\Address; use Creasi\Tests\Feature\TestCase; +use Illuminate\Routing\Middleware\ThrottleRequests; use Laravel\Sanctum\Sanctum; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Test; @@ -31,6 +32,8 @@ class AddressTest extends TestCase #[Test] public function should_receive_404_when_no_data_available(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $response = $this->getJson($this->getRoutePath()); @@ -41,6 +44,8 @@ public function should_receive_404_when_no_data_available(): void #[Test] public function should_able_to_retrieve_all_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $model = Address::factory()->createOne(); @@ -58,6 +63,8 @@ public function should_able_to_retrieve_all_data(): void #[Test] public function should_able_to_store_new_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $data = Address::factory()->raw(); @@ -73,6 +80,8 @@ public function should_able_to_store_new_data(): void #[Test] public function should_able_to_show_existing_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $model = Address::factory()->createOne(); @@ -89,6 +98,8 @@ public function should_able_to_show_existing_data(): void #[Test] public function should_able_to_update_existing_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Address::factory()->createOne(); @@ -104,6 +115,8 @@ public function should_able_to_update_existing_data(): void #[Test] public function should_able_to_delete_and_restore_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $model = Address::factory()->createOne(); diff --git a/tests/Feature/Http/CompanyTest.php b/tests/Feature/Http/CompanyTest.php index 8f770cc..c611a0d 100644 --- a/tests/Feature/Http/CompanyTest.php +++ b/tests/Feature/Http/CompanyTest.php @@ -9,6 +9,7 @@ use Creasi\Base\Enums\StakeholderType; use Creasi\Tests\Feature\TestCase; use Illuminate\Http\UploadedFile; +use Illuminate\Routing\Middleware\ThrottleRequests; use Illuminate\Support\Facades\Storage; use Laravel\Sanctum\Sanctum; use PHPUnit\Framework\Attributes\Group; @@ -33,6 +34,8 @@ class CompanyTest extends TestCase #[Test] public function should_receive_404_when_no_data_available(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $response = $this->getJson($this->getRoutePath()); @@ -43,6 +46,8 @@ public function should_receive_404_when_no_data_available(): void #[Test] public function should_able_to_retrieve_all_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $external = Organization::factory()->createOne(['name' => 'Internal Company']); @@ -61,6 +66,8 @@ public function should_able_to_retrieve_all_data(): void #[Test] public function should_able_to_store_new_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $data = Organization::factory()->raw(); @@ -76,6 +83,8 @@ public function should_able_to_store_new_data(): void #[Test] public function should_able_to_show_existing_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Organization::factory()->createOne(); @@ -91,6 +100,8 @@ public function should_able_to_show_existing_data(): void #[Test] public function should_receive_404_when_no_addresses_available(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Organization::factory()->createOne(); @@ -103,6 +114,8 @@ public function should_receive_404_when_no_addresses_available(): void #[Test] public function should_able_to_create_new_address(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $data = Address::factory()->raw(); @@ -116,6 +129,8 @@ public function should_able_to_create_new_address(): void #[Test] public function should_able_to_retrieve_all_addresses(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Organization::factory()->withAddress()->createOne(); @@ -128,6 +143,8 @@ public function should_able_to_retrieve_all_addresses(): void #[Test] public function should_receive_404_when_no_files_available(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Organization::factory()->createOne(); @@ -140,6 +157,8 @@ public function should_receive_404_when_no_files_available(): void #[Test] public function should_able_to_upload_and_store_new_file(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Storage::fake(); Sanctum::actingAs($this->user()); @@ -156,6 +175,8 @@ public function should_able_to_upload_and_store_new_file(): void #[Test] public function should_able_to_retrieve_all_uploaded_files(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Organization::factory()->withFileUpload(FileType::Document)->createOne(); @@ -168,6 +189,8 @@ public function should_able_to_retrieve_all_uploaded_files(): void #[Test] public function should_able_to_update_existing_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Organization::factory()->createOne(); @@ -183,6 +206,8 @@ public function should_able_to_update_existing_data(): void #[Test] public function should_able_to_delete_and_restore_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Organization::factory()->createOne(); diff --git a/tests/Feature/Http/FileUploadTest.php b/tests/Feature/Http/FileUploadTest.php index 5bc08fd..2aafd97 100644 --- a/tests/Feature/Http/FileUploadTest.php +++ b/tests/Feature/Http/FileUploadTest.php @@ -6,6 +6,7 @@ use Creasi\Base\Enums\FileType; use Creasi\Tests\Feature\TestCase; use Illuminate\Http\UploadedFile; +use Illuminate\Routing\Middleware\ThrottleRequests; use Laravel\Sanctum\Sanctum; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Test; @@ -19,6 +20,8 @@ class FileUploadTest extends TestCase #[Test] public function should_receive_404_when_no_data_available(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $response = $this->getJson($this->getRoutePath()); @@ -29,6 +32,8 @@ public function should_receive_404_when_no_data_available(): void #[Test] public function should_able_to_retrieve_all_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $user->profile->storeFile(FileType::Document, '/doc/file.pdf', 'document'); @@ -41,6 +46,8 @@ public function should_able_to_retrieve_all_data(): void #[Test] public function should_able_to_store_new_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $data = File::factory()->raw(); @@ -55,6 +62,8 @@ public function should_able_to_store_new_data(): void #[Test] public function should_able_to_show_existing_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $model = $user->profile->storeFile(FileType::Document, '/doc/file.pdf', 'document'); @@ -67,6 +76,8 @@ public function should_able_to_show_existing_data(): void #[Test] public function should_able_to_update_existing_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = File::factory()->createOne(); @@ -79,6 +90,8 @@ public function should_able_to_update_existing_data(): void #[Test] public function should_able_to_delete_and_restore_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $model = $user->profile->storeFile(FileType::Document, '/doc/file.pdf', 'document'); diff --git a/tests/Feature/Http/PersonnelTest.php b/tests/Feature/Http/PersonnelTest.php index da8eb73..606f99b 100644 --- a/tests/Feature/Http/PersonnelTest.php +++ b/tests/Feature/Http/PersonnelTest.php @@ -8,6 +8,7 @@ use Creasi\Base\Enums\FileType; use Creasi\Tests\Feature\TestCase; use Illuminate\Http\UploadedFile; +use Illuminate\Routing\Middleware\ThrottleRequests; use Illuminate\Support\Facades\Storage; use Laravel\Sanctum\Sanctum; use PHPUnit\Framework\Attributes\Group; @@ -32,6 +33,8 @@ class PersonnelTest extends TestCase #[Test] public function should_able_to_retrieve_all_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); Person::factory(2)->create(); @@ -47,6 +50,8 @@ public function should_able_to_retrieve_all_data(): void #[Test] public function should_able_to_store_new_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $data = Person::factory()->raw(); @@ -61,6 +66,8 @@ public function should_able_to_store_new_data(): void #[Test] public function should_able_to_show_existing_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Person::factory()->createOne(); @@ -76,6 +83,8 @@ public function should_able_to_show_existing_data(): void #[Test] public function should_receive_404_when_no_addresses_available(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Person::factory()->createOne(); @@ -88,6 +97,8 @@ public function should_receive_404_when_no_addresses_available(): void #[Test] public function should_able_to_create_new_address(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Person::factory()->createOne(); @@ -101,6 +112,8 @@ public function should_able_to_create_new_address(): void #[Test] public function should_able_to_retrieve_all_addresses(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Person::factory()->createOne(); @@ -115,6 +128,8 @@ public function should_able_to_retrieve_all_addresses(): void #[Test] public function should_receive_404_when_no_files_available(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Person::factory()->createOne(); @@ -127,6 +142,8 @@ public function should_receive_404_when_no_files_available(): void #[Test] public function should_able_to_upload_and_store_new_file(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Storage::fake(); Sanctum::actingAs($this->user()); @@ -143,6 +160,8 @@ public function should_able_to_upload_and_store_new_file(): void #[Test] public function should_able_to_retrieve_all_uploaded_files(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Person::factory()->withFileUpload(FileType::Document)->createOne(); @@ -155,6 +174,8 @@ public function should_able_to_retrieve_all_uploaded_files(): void #[Test] public function should_able_to_update_existing_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Person::factory()->createOne(); @@ -170,6 +191,8 @@ public function should_able_to_update_existing_data(): void #[Test] public function should_able_to_delete_and_restore_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $model = Person::factory()->createOne(); diff --git a/tests/Feature/Http/ProfileTest.php b/tests/Feature/Http/ProfileTest.php index a7aaf58..38f77a9 100644 --- a/tests/Feature/Http/ProfileTest.php +++ b/tests/Feature/Http/ProfileTest.php @@ -3,6 +3,7 @@ namespace Creasi\Tests\Feature\Http; use Creasi\Tests\Feature\TestCase; +use Illuminate\Routing\Middleware\ThrottleRequests; use Laravel\Sanctum\Sanctum; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Test; @@ -34,6 +35,8 @@ class ProfileTest extends TestCase #[Test] public function should_able_to_retrieve_profile_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $response = $this->getJson($this->getRoutePath()); @@ -44,6 +47,8 @@ public function should_able_to_retrieve_profile_data(): void #[Test] public function should_able_to_update_profile_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $user->load('profile'); diff --git a/tests/Feature/Http/SettingTest.php b/tests/Feature/Http/SettingTest.php index 8a22b55..01ff4e1 100644 --- a/tests/Feature/Http/SettingTest.php +++ b/tests/Feature/Http/SettingTest.php @@ -3,6 +3,7 @@ namespace Creasi\Tests\Feature\Http; use Creasi\Tests\Feature\TestCase; +use Illuminate\Routing\Middleware\ThrottleRequests; use Laravel\Sanctum\Sanctum; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Test; @@ -17,6 +18,8 @@ class SettingTest extends TestCase #[Test] public function should_able_to_retrieve_setting_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $response = $this->getJson($this->getRoutePath()); @@ -27,6 +30,8 @@ public function should_able_to_retrieve_setting_data(): void #[Test] public function should_able_to_update_setting_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $response = $this->putJson($this->getRoutePath()); diff --git a/tests/Feature/Http/StakeholderTestCase.php b/tests/Feature/Http/StakeholderTestCase.php index 1653042..236669f 100644 --- a/tests/Feature/Http/StakeholderTestCase.php +++ b/tests/Feature/Http/StakeholderTestCase.php @@ -7,6 +7,7 @@ use Creasi\Base\Enums\StakeholderType; use Creasi\Tests\Feature\TestCase; use Illuminate\Contracts\Routing\UrlRoutable; +use Illuminate\Routing\Middleware\ThrottleRequests; use Laravel\Sanctum\Sanctum; use PHPUnit\Framework\Attributes\Group; use PHPUnit\Framework\Attributes\Test; @@ -37,6 +38,8 @@ final protected function getRoutePath(string|UrlRoutable ...$suffixs): string #[Test] public function should_receive_404_when_no_data_available(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $response = $this->getJson($this->getRoutePath()); @@ -47,6 +50,8 @@ public function should_receive_404_when_no_data_available(): void #[Test] public function should_able_to_retrieve_all_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $company = Organization::factory()->createOne(['name' => 'External Company']); @@ -67,6 +72,8 @@ public function should_able_to_retrieve_all_data(): void #[Test] public function should_able_to_store_new_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($this->user()); $data = Organization::factory()->raw(); @@ -82,6 +89,8 @@ public function should_able_to_store_new_data(): void #[Test] public function should_able_to_show_existing_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $model = Organization::factory()->createOne(); @@ -99,6 +108,8 @@ public function should_able_to_show_existing_data(): void #[Test] public function should_able_to_update_existing_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $model = Organization::factory()->createOne(); @@ -116,6 +127,8 @@ public function should_able_to_update_existing_data(): void #[Test] public function should_able_to_delete_and_restore_data(): void { + $this->withoutMiddleware(ThrottleRequests::class); + Sanctum::actingAs($user = $this->user()); $model = Organization::factory()->createOne();