diff --git a/tests/API/APIDocsAvailabilityTest.php b/tests/API/APIDocsAvailabilityTest.php index b7caa873..a7bba3d6 100644 --- a/tests/API/APIDocsAvailabilityTest.php +++ b/tests/API/APIDocsAvailabilityTest.php @@ -28,7 +28,7 @@ use App\Entity\UserSystem\User; use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class APIDocsAvailabilityTest extends WebTestCase +final class APIDocsAvailabilityTest extends WebTestCase { #[DataProvider('urlProvider')] public function testDocAvailabilityForLoggedInUser(string $url): void diff --git a/tests/API/APITokenAuthenticationTest.php b/tests/API/APITokenAuthenticationTest.php index a78b0594..803a1819 100644 --- a/tests/API/APITokenAuthenticationTest.php +++ b/tests/API/APITokenAuthenticationTest.php @@ -27,7 +27,7 @@ use ApiPlatform\Symfony\Bundle\Test\ApiTestCase; use App\DataFixtures\APITokenFixtures; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use ApiPlatform\Symfony\Bundle\Test\Client; -class APITokenAuthenticationTest extends ApiTestCase +final class APITokenAuthenticationTest extends ApiTestCase { public function testUnauthenticated(): void { diff --git a/tests/API/Endpoints/ApiTokenEnpointTest.php b/tests/API/Endpoints/ApiTokenEnpointTest.php index 99340182..f21716bd 100644 --- a/tests/API/Endpoints/ApiTokenEnpointTest.php +++ b/tests/API/Endpoints/ApiTokenEnpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\AuthenticatedApiTestCase; -class ApiTokenEnpointTest extends AuthenticatedApiTestCase +final class ApiTokenEnpointTest extends AuthenticatedApiTestCase { public function testGetCurrentToken(): void { diff --git a/tests/API/Endpoints/AttachmentTypeEndpointTest.php b/tests/API/Endpoints/AttachmentTypeEndpointTest.php index f90f3d94..fb5770d5 100644 --- a/tests/API/Endpoints/AttachmentTypeEndpointTest.php +++ b/tests/API/Endpoints/AttachmentTypeEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class AttachmentTypeEndpointTest extends CrudEndpointTestCase +final class AttachmentTypeEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/AttachmentsEndpointTest.php b/tests/API/Endpoints/AttachmentsEndpointTest.php index 8f4d7e77..999b7ad3 100644 --- a/tests/API/Endpoints/AttachmentsEndpointTest.php +++ b/tests/API/Endpoints/AttachmentsEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\AuthenticatedApiTestCase; -class AttachmentsEndpointTest extends AuthenticatedApiTestCase +final class AttachmentsEndpointTest extends AuthenticatedApiTestCase { public function testGetCollection(): void { diff --git a/tests/API/Endpoints/CategoryEndpointTest.php b/tests/API/Endpoints/CategoryEndpointTest.php index 68f4fd2d..5f54d1dd 100644 --- a/tests/API/Endpoints/CategoryEndpointTest.php +++ b/tests/API/Endpoints/CategoryEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class CategoryEndpointTest extends CrudEndpointTestCase +final class CategoryEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/CurrencyEndpointTest.php b/tests/API/Endpoints/CurrencyEndpointTest.php index a463daeb..a9f36633 100644 --- a/tests/API/Endpoints/CurrencyEndpointTest.php +++ b/tests/API/Endpoints/CurrencyEndpointTest.php @@ -24,7 +24,7 @@ declare(strict_types=1); namespace App\Tests\API\Endpoints; -class CurrencyEndpointTest extends CrudEndpointTestCase +final class CurrencyEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/FootprintsEndpointTest.php b/tests/API/Endpoints/FootprintsEndpointTest.php index f3f359a2..fd6374f9 100644 --- a/tests/API/Endpoints/FootprintsEndpointTest.php +++ b/tests/API/Endpoints/FootprintsEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class FootprintsEndpointTest extends CrudEndpointTestCase +final class FootprintsEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/InfoEndpointTest.php b/tests/API/Endpoints/InfoEndpointTest.php index 09f02e8a..6e996c0c 100644 --- a/tests/API/Endpoints/InfoEndpointTest.php +++ b/tests/API/Endpoints/InfoEndpointTest.php @@ -25,7 +25,7 @@ namespace API\Endpoints; use App\Tests\API\AuthenticatedApiTestCase; -class InfoEndpointTest extends AuthenticatedApiTestCase +final class InfoEndpointTest extends AuthenticatedApiTestCase { public function testGetInfo(): void { diff --git a/tests/API/Endpoints/ManufacturersEndpointTest.php b/tests/API/Endpoints/ManufacturersEndpointTest.php index 482ec98d..80447c93 100644 --- a/tests/API/Endpoints/ManufacturersEndpointTest.php +++ b/tests/API/Endpoints/ManufacturersEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class ManufacturersEndpointTest extends CrudEndpointTestCase +final class ManufacturersEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/MeasurementUnitsEndpointTest.php b/tests/API/Endpoints/MeasurementUnitsEndpointTest.php index db7341db..d659fb1c 100644 --- a/tests/API/Endpoints/MeasurementUnitsEndpointTest.php +++ b/tests/API/Endpoints/MeasurementUnitsEndpointTest.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace App\Tests\API\Endpoints; -class MeasurementUnitsEndpointTest extends CrudEndpointTestCase +final class MeasurementUnitsEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/OrderdetailsEndpointTest.php b/tests/API/Endpoints/OrderdetailsEndpointTest.php index 92823103..d7d132d9 100644 --- a/tests/API/Endpoints/OrderdetailsEndpointTest.php +++ b/tests/API/Endpoints/OrderdetailsEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class OrderdetailsEndpointTest extends CrudEndpointTestCase +final class OrderdetailsEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/ParametersEndpointTest.php b/tests/API/Endpoints/ParametersEndpointTest.php index 733df59a..323fc7b8 100644 --- a/tests/API/Endpoints/ParametersEndpointTest.php +++ b/tests/API/Endpoints/ParametersEndpointTest.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace App\Tests\API\Endpoints; -class ParametersEndpointTest extends CrudEndpointTestCase +final class ParametersEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/PartAssociationsEndpointTest.php b/tests/API/Endpoints/PartAssociationsEndpointTest.php index 62408dbb..7ac81ff6 100644 --- a/tests/API/Endpoints/PartAssociationsEndpointTest.php +++ b/tests/API/Endpoints/PartAssociationsEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class PartAssociationsEndpointTest extends CrudEndpointTestCase +final class PartAssociationsEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/PartCustomStateEndpointTest.php b/tests/API/Endpoints/PartCustomStateEndpointTest.php index ac353d9c..8d1253f3 100644 --- a/tests/API/Endpoints/PartCustomStateEndpointTest.php +++ b/tests/API/Endpoints/PartCustomStateEndpointTest.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace App\Tests\API\Endpoints; -class PartCustomStateEndpointTest extends CrudEndpointTestCase +final class PartCustomStateEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/PartEndpointTest.php b/tests/API/Endpoints/PartEndpointTest.php index 9406fc78..8d66d362 100644 --- a/tests/API/Endpoints/PartEndpointTest.php +++ b/tests/API/Endpoints/PartEndpointTest.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace App\Tests\API\Endpoints; -class PartEndpointTest extends CrudEndpointTestCase +final class PartEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/PartLotsEndpointTest.php b/tests/API/Endpoints/PartLotsEndpointTest.php index 38aa6b18..70f1f9ab 100644 --- a/tests/API/Endpoints/PartLotsEndpointTest.php +++ b/tests/API/Endpoints/PartLotsEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class PartLotsEndpointTest extends CrudEndpointTestCase +final class PartLotsEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/PricedetailsEndpointTest.php b/tests/API/Endpoints/PricedetailsEndpointTest.php index 8895365f..5661c0c7 100644 --- a/tests/API/Endpoints/PricedetailsEndpointTest.php +++ b/tests/API/Endpoints/PricedetailsEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class PricedetailsEndpointTest extends CrudEndpointTestCase +final class PricedetailsEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/ProjectBOMEntriesEndpointTest.php b/tests/API/Endpoints/ProjectBOMEntriesEndpointTest.php index cafb57dc..10dbf747 100644 --- a/tests/API/Endpoints/ProjectBOMEntriesEndpointTest.php +++ b/tests/API/Endpoints/ProjectBOMEntriesEndpointTest.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace App\Tests\API\Endpoints; -class ProjectBOMEntriesEndpointTest extends CrudEndpointTestCase +final class ProjectBOMEntriesEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/ProjectsEndpointTest.php b/tests/API/Endpoints/ProjectsEndpointTest.php index 9daf584a..ea9cc6b4 100644 --- a/tests/API/Endpoints/ProjectsEndpointTest.php +++ b/tests/API/Endpoints/ProjectsEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class ProjectsEndpointTest extends CrudEndpointTestCase +final class ProjectsEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/StorageLocationsEndpointTest.php b/tests/API/Endpoints/StorageLocationsEndpointTest.php index 8d9641c4..11947e71 100644 --- a/tests/API/Endpoints/StorageLocationsEndpointTest.php +++ b/tests/API/Endpoints/StorageLocationsEndpointTest.php @@ -25,7 +25,7 @@ namespace API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class StorageLocationsEndpointTest extends CrudEndpointTestCase +final class StorageLocationsEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/SuppliersEndpointTest.php b/tests/API/Endpoints/SuppliersEndpointTest.php index 1941f849..bbb64e90 100644 --- a/tests/API/Endpoints/SuppliersEndpointTest.php +++ b/tests/API/Endpoints/SuppliersEndpointTest.php @@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints; use App\Tests\API\Endpoints\CrudEndpointTestCase; -class SuppliersEndpointTest extends CrudEndpointTestCase +final class SuppliersEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/API/Endpoints/UsersEndpointTest.php b/tests/API/Endpoints/UsersEndpointTest.php index 0f075a7c..e6e18930 100644 --- a/tests/API/Endpoints/UsersEndpointTest.php +++ b/tests/API/Endpoints/UsersEndpointTest.php @@ -23,7 +23,7 @@ declare(strict_types=1); namespace App\Tests\API\Endpoints; -class UsersEndpointTest extends CrudEndpointTestCase +final class UsersEndpointTest extends CrudEndpointTestCase { protected function getBasePath(): string diff --git a/tests/ApplicationAvailabilityFunctionalTest.php b/tests/ApplicationAvailabilityFunctionalTest.php index d5bced49..c7449411 100644 --- a/tests/ApplicationAvailabilityFunctionalTest.php +++ b/tests/ApplicationAvailabilityFunctionalTest.php @@ -32,7 +32,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; */ #[Group('DB')] #[Group('slow')] -class ApplicationAvailabilityFunctionalTest extends WebTestCase +final class ApplicationAvailabilityFunctionalTest extends WebTestCase { #[DataProvider('urlProvider')] public function testPageIsSuccessful(string $url): void diff --git a/tests/Controller/AdminPages/AttachmentTypeController.php b/tests/Controller/AdminPages/AttachmentTypeController.php index 599a6f69..90e6583d 100644 --- a/tests/Controller/AdminPages/AttachmentTypeController.php +++ b/tests/Controller/AdminPages/AttachmentTypeController.php @@ -27,7 +27,7 @@ use App\Entity\Attachments\AttachmentType; #[Group('slow')] #[Group('DB')] -class AttachmentTypeController extends AbstractAdminController +final class AttachmentTypeController extends AbstractAdminController { protected static string $base_path = '/en/attachment_type'; protected static string $entity_class = AttachmentType::class; diff --git a/tests/Controller/AdminPages/CategoryController.php b/tests/Controller/AdminPages/CategoryController.php index c1bac093..5d8396e7 100644 --- a/tests/Controller/AdminPages/CategoryController.php +++ b/tests/Controller/AdminPages/CategoryController.php @@ -27,7 +27,7 @@ use App\Entity\Parts\Category; #[Group('slow')] #[Group('DB')] -class CategoryController extends AbstractAdminController +final class CategoryController extends AbstractAdminController { protected static string $base_path = '/en/category'; protected static string $entity_class = Category::class; diff --git a/tests/Controller/AdminPages/CurrencyController.php b/tests/Controller/AdminPages/CurrencyController.php index 21f94a29..4ebd82e2 100644 --- a/tests/Controller/AdminPages/CurrencyController.php +++ b/tests/Controller/AdminPages/CurrencyController.php @@ -28,7 +28,7 @@ use App\Entity\Parts\Manufacturer; #[Group('slow')] #[Group('DB')] -class CurrencyController extends AbstractAdminController +final class CurrencyController extends AbstractAdminController { protected static string $base_path = '/en/currency'; protected static string $entity_class = Currency::class; diff --git a/tests/Controller/AdminPages/FootprintController.php b/tests/Controller/AdminPages/FootprintController.php index 7d617ba8..2643d3f1 100644 --- a/tests/Controller/AdminPages/FootprintController.php +++ b/tests/Controller/AdminPages/FootprintController.php @@ -27,7 +27,7 @@ use App\Entity\Parts\Footprint; #[Group('slow')] #[Group('DB')] -class FootprintController extends AbstractAdminController +final class FootprintController extends AbstractAdminController { protected static string $base_path = '/en/footprint'; protected static string $entity_class = Footprint::class; diff --git a/tests/Controller/AdminPages/LabelProfileController.php b/tests/Controller/AdminPages/LabelProfileController.php index 838d872e..d407701a 100644 --- a/tests/Controller/AdminPages/LabelProfileController.php +++ b/tests/Controller/AdminPages/LabelProfileController.php @@ -46,7 +46,7 @@ use PHPUnit\Framework\Attributes\Group; use App\Entity\LabelSystem\LabelProfile; use Symfony\Component\Security\Core\Exception\AccessDeniedException; -class LabelProfileController extends AbstractAdminController +final class LabelProfileController extends AbstractAdminController { protected static string $base_path = '/en/label_profile'; protected static string $entity_class = LabelProfile::class; diff --git a/tests/Controller/AdminPages/ManufacturerController.php b/tests/Controller/AdminPages/ManufacturerController.php index c2666f72..2a5ed386 100644 --- a/tests/Controller/AdminPages/ManufacturerController.php +++ b/tests/Controller/AdminPages/ManufacturerController.php @@ -27,7 +27,7 @@ use App\Entity\Parts\Manufacturer; #[Group('slow')] #[Group('DB')] -class ManufacturerController extends AbstractAdminController +final class ManufacturerController extends AbstractAdminController { protected static string $base_path = '/en/manufacturer'; protected static string $entity_class = Manufacturer::class; diff --git a/tests/Controller/AdminPages/MeasurementUnitController.php b/tests/Controller/AdminPages/MeasurementUnitController.php index 351f4e51..c15d4af4 100644 --- a/tests/Controller/AdminPages/MeasurementUnitController.php +++ b/tests/Controller/AdminPages/MeasurementUnitController.php @@ -27,7 +27,7 @@ use App\Entity\Parts\MeasurementUnit; #[Group('slow')] #[Group('DB')] -class MeasurementUnitController extends AbstractAdminController +final class MeasurementUnitController extends AbstractAdminController { protected static string $base_path = '/en/measurement_unit'; protected static string $entity_class = MeasurementUnit::class; diff --git a/tests/Controller/AdminPages/PartCustomStateControllerTest.php b/tests/Controller/AdminPages/PartCustomStateControllerTest.php index 3e87dfe2..77d1127c 100644 --- a/tests/Controller/AdminPages/PartCustomStateControllerTest.php +++ b/tests/Controller/AdminPages/PartCustomStateControllerTest.php @@ -27,7 +27,7 @@ use PHPUnit\Framework\Attributes\Group; #[Group('slow')] #[Group('DB')] -class PartCustomStateControllerTest extends AbstractAdminController +final class PartCustomStateControllerTest extends AbstractAdminController { protected static string $base_path = '/en/part_custom_state'; protected static string $entity_class = PartCustomState::class; diff --git a/tests/Controller/AdminPages/ProjectController.php b/tests/Controller/AdminPages/ProjectController.php index 1de4bf52..d7bec069 100644 --- a/tests/Controller/AdminPages/ProjectController.php +++ b/tests/Controller/AdminPages/ProjectController.php @@ -28,7 +28,7 @@ use App\Entity\ProjectSystem\Project; #[Group('slow')] #[Group('DB')] -class ProjectController extends AbstractAdminController +final class ProjectController extends AbstractAdminController { protected static string $base_path = '/en/project'; protected static string $entity_class = Project::class; diff --git a/tests/Controller/AdminPages/StorelocationController.php b/tests/Controller/AdminPages/StorelocationController.php index fee06c67..f19a5f6a 100644 --- a/tests/Controller/AdminPages/StorelocationController.php +++ b/tests/Controller/AdminPages/StorelocationController.php @@ -27,7 +27,7 @@ use App\Entity\Parts\StorageLocation; #[Group('slow')] #[Group('DB')] -class StorelocationController extends AbstractAdminController +final class StorelocationController extends AbstractAdminController { protected static string $base_path = '/en/store_location'; protected static string $entity_class = StorageLocation::class; diff --git a/tests/Controller/AdminPages/SupplierController.php b/tests/Controller/AdminPages/SupplierController.php index 3549eb4b..1e1d720a 100644 --- a/tests/Controller/AdminPages/SupplierController.php +++ b/tests/Controller/AdminPages/SupplierController.php @@ -27,7 +27,7 @@ use App\Entity\Parts\Supplier; #[Group('slow')] #[Group('DB')] -class SupplierController extends AbstractAdminController +final class SupplierController extends AbstractAdminController { protected static string $base_path = '/en/supplier'; protected static string $entity_class = Supplier::class; diff --git a/tests/Controller/BulkInfoProviderImportControllerTest.php b/tests/Controller/BulkInfoProviderImportControllerTest.php index 8961d23b..ec3629fe 100644 --- a/tests/Controller/BulkInfoProviderImportControllerTest.php +++ b/tests/Controller/BulkInfoProviderImportControllerTest.php @@ -22,6 +22,8 @@ declare(strict_types=1); namespace App\Tests\Controller; +use App\Services\InfoProviderSystem\BulkInfoProviderService; +use App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO; use App\Entity\InfoProviderSystem\BulkImportJobStatus; use App\Entity\InfoProviderSystem\BulkInfoProviderImportJob; use App\Entity\Parts\Part; @@ -36,7 +38,7 @@ use Symfony\Component\HttpFoundation\Response; #[Group("slow")] #[Group("DB")] -class BulkInfoProviderImportControllerTest extends WebTestCase +final class BulkInfoProviderImportControllerTest extends WebTestCase { public function testStep1WithoutIds(): void { @@ -174,8 +176,8 @@ class BulkInfoProviderImportControllerTest extends WebTestCase // Verify the template rendered the source_field and source_keyword correctly $content = $client->getResponse()->getContent(); - $this->assertStringContainsString('test_field', $content); - $this->assertStringContainsString('test_keyword', $content); + $this->assertStringContainsString('test_field', (string) $content); + $this->assertStringContainsString('test_keyword', (string) $content); // Clean up - find by ID to avoid detached entity issues $jobId = $job->getId(); @@ -607,7 +609,7 @@ class BulkInfoProviderImportControllerTest extends WebTestCase } $this->assertResponseStatusCodeSame(Response::HTTP_OK); - $this->assertStringContainsString('Bulk Info Provider Import', $client->getResponse()->getContent()); + $this->assertStringContainsString('Bulk Info Provider Import', (string) $client->getResponse()->getContent()); } public function testStep1FormSubmissionWithErrors(): void @@ -630,7 +632,7 @@ class BulkInfoProviderImportControllerTest extends WebTestCase } $this->assertResponseStatusCodeSame(Response::HTTP_OK); - $this->assertStringContainsString('Bulk Info Provider Import', $client->getResponse()->getContent()); + $this->assertStringContainsString('Bulk Info Provider Import', (string) $client->getResponse()->getContent()); } public function testBulkInfoProviderServiceKeywordExtraction(): void @@ -647,18 +649,18 @@ class BulkInfoProviderImportControllerTest extends WebTestCase } // Test that the service can extract keywords from parts - $bulkService = $client->getContainer()->get(\App\Services\InfoProviderSystem\BulkInfoProviderService::class); + $bulkService = $client->getContainer()->get(BulkInfoProviderService::class); // Create field mappings to verify the service works $fieldMappings = [ - new \App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO('name', ['test'], 1), - new \App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO('mpn', ['test'], 2) + new BulkSearchFieldMappingDTO('name', ['test'], 1), + new BulkSearchFieldMappingDTO('mpn', ['test'], 2) ]; // The service may return an empty result or throw when no results are found try { $result = $bulkService->performBulkSearch([$part], $fieldMappings, false); - $this->assertInstanceOf(\App\Services\InfoProviderSystem\DTOs\BulkSearchResponseDTO::class, $result); + $this->assertInstanceOf(BulkSearchResponseDTO::class, $result); } catch (\RuntimeException $e) { $this->assertStringContainsString('No search results found', $e->getMessage()); } @@ -725,12 +727,12 @@ class BulkInfoProviderImportControllerTest extends WebTestCase } // Test that the service can handle supplier part number fields - $bulkService = $client->getContainer()->get(\App\Services\InfoProviderSystem\BulkInfoProviderService::class); + $bulkService = $client->getContainer()->get(BulkInfoProviderService::class); // Create field mappings with supplier SPN field mapping $fieldMappings = [ - new \App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO('invalid_field', ['test'], 1), - new \App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO('test_supplier_spn', ['test'], 2) + new BulkSearchFieldMappingDTO('invalid_field', ['test'], 1), + new BulkSearchFieldMappingDTO('test_supplier_spn', ['test'], 2) ]; // The service should be able to process the request and throw an exception when no results are found @@ -756,11 +758,11 @@ class BulkInfoProviderImportControllerTest extends WebTestCase } // Test that the service can handle batch processing - $bulkService = $client->getContainer()->get(\App\Services\InfoProviderSystem\BulkInfoProviderService::class); + $bulkService = $client->getContainer()->get(BulkInfoProviderService::class); // Create field mappings with multiple keywords $fieldMappings = [ - new \App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO('empty', ['test'], 1) + new BulkSearchFieldMappingDTO('empty', ['test'], 1) ]; // The service should be able to process the request and throw an exception when no results are found @@ -786,7 +788,7 @@ class BulkInfoProviderImportControllerTest extends WebTestCase } // Test that the service can handle prefetch details - $bulkService = $client->getContainer()->get(\App\Services\InfoProviderSystem\BulkInfoProviderService::class); + $bulkService = $client->getContainer()->get(BulkInfoProviderService::class); // Create empty search results to test prefetch method $searchResults = new BulkSearchResponseDTO([ diff --git a/tests/Controller/KiCadApiControllerTest.php b/tests/Controller/KiCadApiControllerTest.php index a66cb8a4..9d33512a 100644 --- a/tests/Controller/KiCadApiControllerTest.php +++ b/tests/Controller/KiCadApiControllerTest.php @@ -27,7 +27,7 @@ use App\DataFixtures\APITokenFixtures; use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class KiCadApiControllerTest extends WebTestCase +final class KiCadApiControllerTest extends WebTestCase { private const BASE_URL = '/en/kicad-api/v1'; diff --git a/tests/Controller/PartControllerTest.php b/tests/Controller/PartControllerTest.php index 8c9f3729..c15bdd51 100644 --- a/tests/Controller/PartControllerTest.php +++ b/tests/Controller/PartControllerTest.php @@ -38,7 +38,7 @@ use Symfony\Component\HttpFoundation\Response; #[Group("slow")] #[Group("DB")] -class PartControllerTest extends WebTestCase +final class PartControllerTest extends WebTestCase { public function testShowPart(): void { diff --git a/tests/Controller/RedirectControllerTest.php b/tests/Controller/RedirectControllerTest.php index ac2776e5..420b0f49 100644 --- a/tests/Controller/RedirectControllerTest.php +++ b/tests/Controller/RedirectControllerTest.php @@ -33,7 +33,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; #[Group('slow')] #[Group('DB')] -class RedirectControllerTest extends WebTestCase +final class RedirectControllerTest extends WebTestCase { protected EntityManagerInterface $em; protected UserRepository $userRepo; diff --git a/tests/Controller/ScanControllerTest.php b/tests/Controller/ScanControllerTest.php index 98992e09..b504cd29 100644 --- a/tests/Controller/ScanControllerTest.php +++ b/tests/Controller/ScanControllerTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Controller; use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class ScanControllerTest extends WebTestCase +final class ScanControllerTest extends WebTestCase { private ?KernelBrowser $client = null; diff --git a/tests/DataTables/Filters/CompoundFilterTraitTest.php b/tests/DataTables/Filters/CompoundFilterTraitTest.php index 93f3c1e1..d9bf20b0 100644 --- a/tests/DataTables/Filters/CompoundFilterTraitTest.php +++ b/tests/DataTables/Filters/CompoundFilterTraitTest.php @@ -27,7 +27,7 @@ use App\DataTables\Filters\FilterInterface; use Doctrine\ORM\QueryBuilder; use PHPUnit\Framework\TestCase; -class CompoundFilterTraitTest extends TestCase +final class CompoundFilterTraitTest extends TestCase { public function testFindAllChildFiltersEmpty(): void @@ -49,9 +49,9 @@ class CompoundFilterTraitTest extends TestCase public function testFindAllChildFilters(): void { - $f1 = $this->createMock(FilterInterface::class); - $f2 = $this->createMock(FilterInterface::class); - $f3 = $this->createMock(FilterInterface::class); + $f1 = $this->createStub(FilterInterface::class); + $f2 = $this->createStub(FilterInterface::class); + $f3 = $this->createStub(FilterInterface::class); $filter = new class($f1, $f2, $f3, null) { use CompoundFilterTrait; @@ -108,7 +108,7 @@ class CompoundFilterTraitTest extends TestCase } }; - $qb = $this->createMock(QueryBuilder::class); + $qb = $this->createStub(QueryBuilder::class); $filter->_applyAllChildFilters($qb); } diff --git a/tests/DataTables/Filters/Constraints/FilterTraitTest.php b/tests/DataTables/Filters/Constraints/FilterTraitTest.php index e1e459d5..a7493dcf 100644 --- a/tests/DataTables/Filters/Constraints/FilterTraitTest.php +++ b/tests/DataTables/Filters/Constraints/FilterTraitTest.php @@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\DataTables\Filters\Constraints\FilterTrait; use PHPUnit\Framework\TestCase; -class FilterTraitTest extends TestCase +final class FilterTraitTest extends TestCase { use FilterTrait; diff --git a/tests/DataTables/Filters/Constraints/Part/BulkImportJobStatusConstraintTest.php b/tests/DataTables/Filters/Constraints/Part/BulkImportJobStatusConstraintTest.php index 816a8035..333b9af5 100644 --- a/tests/DataTables/Filters/Constraints/Part/BulkImportJobStatusConstraintTest.php +++ b/tests/DataTables/Filters/Constraints/Part/BulkImportJobStatusConstraintTest.php @@ -28,7 +28,7 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\QueryBuilder; use PHPUnit\Framework\TestCase; -class BulkImportJobStatusConstraintTest extends TestCase +final class BulkImportJobStatusConstraintTest extends TestCase { private BulkImportJobStatusConstraint $constraint; private QueryBuilder $queryBuilder; @@ -46,7 +46,7 @@ class BulkImportJobStatusConstraintTest extends TestCase public function testConstructor(): void { - $this->assertEquals([], $this->constraint->getValue()); + $this->assertSame([], $this->constraint->getValue()); $this->assertEmpty($this->constraint->getOperator()); $this->assertFalse($this->constraint->isEnabled()); } @@ -56,7 +56,7 @@ class BulkImportJobStatusConstraintTest extends TestCase $values = ['pending', 'in_progress']; $this->constraint->setValue($values); - $this->assertEquals($values, $this->constraint->getValue()); + $this->assertSame($values, $this->constraint->getValue()); } public function testGetAndSetOperator(): void @@ -64,7 +64,7 @@ class BulkImportJobStatusConstraintTest extends TestCase $operator = 'ANY'; $this->constraint->setOperator($operator); - $this->assertEquals($operator, $this->constraint->getOperator()); + $this->assertSame($operator, $this->constraint->getOperator()); } public function testIsEnabledWithEmptyValues(): void diff --git a/tests/DataTables/Filters/Constraints/Part/BulkImportPartStatusConstraintTest.php b/tests/DataTables/Filters/Constraints/Part/BulkImportPartStatusConstraintTest.php index bc110eda..e2b37287 100644 --- a/tests/DataTables/Filters/Constraints/Part/BulkImportPartStatusConstraintTest.php +++ b/tests/DataTables/Filters/Constraints/Part/BulkImportPartStatusConstraintTest.php @@ -28,7 +28,7 @@ use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\QueryBuilder; use PHPUnit\Framework\TestCase; -class BulkImportPartStatusConstraintTest extends TestCase +final class BulkImportPartStatusConstraintTest extends TestCase { private BulkImportPartStatusConstraint $constraint; private QueryBuilder $queryBuilder; @@ -46,7 +46,7 @@ class BulkImportPartStatusConstraintTest extends TestCase public function testConstructor(): void { - $this->assertEquals([], $this->constraint->getValue()); + $this->assertSame([], $this->constraint->getValue()); $this->assertEmpty($this->constraint->getOperator()); $this->assertFalse($this->constraint->isEnabled()); } @@ -56,7 +56,7 @@ class BulkImportPartStatusConstraintTest extends TestCase $values = ['pending', 'completed', 'skipped']; $this->constraint->setValue($values); - $this->assertEquals($values, $this->constraint->getValue()); + $this->assertSame($values, $this->constraint->getValue()); } public function testGetAndSetOperator(): void @@ -64,7 +64,7 @@ class BulkImportPartStatusConstraintTest extends TestCase $operator = 'ANY'; $this->constraint->setOperator($operator); - $this->assertEquals($operator, $this->constraint->getOperator()); + $this->assertSame($operator, $this->constraint->getOperator()); } public function testIsEnabledWithEmptyValues(): void @@ -294,6 +294,6 @@ class BulkImportPartStatusConstraintTest extends TestCase $this->constraint->apply($this->queryBuilder); - $this->assertEquals($statusValues, $this->constraint->getValue()); + $this->assertSame($statusValues, $this->constraint->getValue()); } } diff --git a/tests/DatatablesAvailabilityTest.php b/tests/DatatablesAvailabilityTest.php index dad61be3..1447da73 100644 --- a/tests/DatatablesAvailabilityTest.php +++ b/tests/DatatablesAvailabilityTest.php @@ -44,7 +44,7 @@ namespace App\Tests; use PHPUnit\Framework\Attributes\DataProvider; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class DatatablesAvailabilityTest extends WebTestCase +final class DatatablesAvailabilityTest extends WebTestCase { #[DataProvider('urlProvider')] public function testDataTable(string $url, ?array $ordering = null): void diff --git a/tests/Doctrine/SQLiteRegexMiddlewareTest.php b/tests/Doctrine/SQLiteRegexMiddlewareTest.php index 67410f76..aa5e4da1 100644 --- a/tests/Doctrine/SQLiteRegexMiddlewareTest.php +++ b/tests/Doctrine/SQLiteRegexMiddlewareTest.php @@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Doctrine\Middleware\SQLiteRegexExtensionMiddlewareDriver; use PHPUnit\Framework\TestCase; -class SQLiteRegexMiddlewareTest extends TestCase +final class SQLiteRegexMiddlewareTest extends TestCase { public static function regexpDataProvider(): \Generator diff --git a/tests/Entity/Attachments/AttachmentTest.php b/tests/Entity/Attachments/AttachmentTest.php index 35222d63..ca55424c 100644 --- a/tests/Entity/Attachments/AttachmentTest.php +++ b/tests/Entity/Attachments/AttachmentTest.php @@ -55,7 +55,7 @@ use InvalidArgumentException; use PHPUnit\Framework\TestCase; use ReflectionClass; -class AttachmentTest extends TestCase +final class AttachmentTest extends TestCase { public function testEmptyState(): void { diff --git a/tests/Entity/Attachments/AttachmentTypeTest.php b/tests/Entity/Attachments/AttachmentTypeTest.php index ea80db11..c966d23f 100644 --- a/tests/Entity/Attachments/AttachmentTypeTest.php +++ b/tests/Entity/Attachments/AttachmentTypeTest.php @@ -28,7 +28,7 @@ use App\Entity\Attachments\UserAttachment; use Doctrine\Common\Collections\Collection; use PHPUnit\Framework\TestCase; -class AttachmentTypeTest extends TestCase +final class AttachmentTypeTest extends TestCase { public function testEmptyState(): void { diff --git a/tests/Entity/Base/AbstractStructuralDBElementTest.php b/tests/Entity/Base/AbstractStructuralDBElementTest.php index 3f8157ad..90a7dee2 100644 --- a/tests/Entity/Base/AbstractStructuralDBElementTest.php +++ b/tests/Entity/Base/AbstractStructuralDBElementTest.php @@ -31,7 +31,7 @@ use PHPUnit\Framework\TestCase; * Test StructuralDBElement entities. * Note: Because StructuralDBElement is abstract we use AttachmentType here as a placeholder. */ -class AbstractStructuralDBElementTest extends TestCase +final class AbstractStructuralDBElementTest extends TestCase { protected AttachmentType $root; protected AttachmentType $child1; diff --git a/tests/Entity/BulkImportJobStatusTest.php b/tests/Entity/BulkImportJobStatusTest.php index e8b4a977..c38d62e2 100644 --- a/tests/Entity/BulkImportJobStatusTest.php +++ b/tests/Entity/BulkImportJobStatusTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Entity; use App\Entity\InfoProviderSystem\BulkImportJobStatus; use PHPUnit\Framework\TestCase; -class BulkImportJobStatusTest extends TestCase +final class BulkImportJobStatusTest extends TestCase { public function testEnumValues(): void { diff --git a/tests/Entity/BulkInfoProviderImportJobPartTest.php b/tests/Entity/BulkInfoProviderImportJobPartTest.php index dd9600dd..fdae58e5 100644 --- a/tests/Entity/BulkInfoProviderImportJobPartTest.php +++ b/tests/Entity/BulkInfoProviderImportJobPartTest.php @@ -28,32 +28,27 @@ use App\Entity\InfoProviderSystem\BulkInfoProviderImportJobPart; use App\Entity\Parts\Part; use PHPUnit\Framework\TestCase; -class BulkInfoProviderImportJobPartTest extends TestCase +final class BulkInfoProviderImportJobPartTest extends TestCase { - private BulkInfoProviderImportJob $job; - private Part $part; private BulkInfoProviderImportJobPart $jobPart; protected function setUp(): void { - $this->job = $this->createMock(BulkInfoProviderImportJob::class); - $this->part = $this->createMock(Part::class); - - $this->jobPart = new BulkInfoProviderImportJobPart($this->job, $this->part); + $this->jobPart = new BulkInfoProviderImportJobPart($this->createStub(BulkInfoProviderImportJob::class), $this->createStub(Part::class)); } public function testConstructor(): void { - $this->assertSame($this->job, $this->jobPart->getJob()); - $this->assertSame($this->part, $this->jobPart->getPart()); - $this->assertEquals(BulkImportPartStatus::PENDING, $this->jobPart->getStatus()); + $this->assertSame($this->createStub(BulkInfoProviderImportJob::class), $this->jobPart->getJob()); + $this->assertSame($this->createStub(Part::class), $this->jobPart->getPart()); + $this->assertSame(BulkImportPartStatus::PENDING, $this->jobPart->getStatus()); $this->assertNull($this->jobPart->getReason()); $this->assertNull($this->jobPart->getCompletedAt()); } public function testGetAndSetJob(): void { - $newJob = $this->createMock(BulkInfoProviderImportJob::class); + $newJob = $this->createStub(BulkInfoProviderImportJob::class); $result = $this->jobPart->setJob($newJob); @@ -63,7 +58,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase public function testGetAndSetPart(): void { - $newPart = $this->createMock(Part::class); + $newPart = $this->createStub(Part::class); $result = $this->jobPart->setPart($newPart); @@ -76,7 +71,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase $result = $this->jobPart->setStatus(BulkImportPartStatus::COMPLETED); $this->assertSame($this->jobPart, $result); - $this->assertEquals(BulkImportPartStatus::COMPLETED, $this->jobPart->getStatus()); + $this->assertSame(BulkImportPartStatus::COMPLETED, $this->jobPart->getStatus()); } public function testGetAndSetReason(): void @@ -86,7 +81,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase $result = $this->jobPart->setReason($reason); $this->assertSame($this->jobPart, $result); - $this->assertEquals($reason, $this->jobPart->getReason()); + $this->assertSame($reason, $this->jobPart->getReason()); } public function testGetAndSetCompletedAt(): void @@ -108,7 +103,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase $afterTime = new \DateTimeImmutable(); $this->assertSame($this->jobPart, $result); - $this->assertEquals(BulkImportPartStatus::COMPLETED, $this->jobPart->getStatus()); + $this->assertSame(BulkImportPartStatus::COMPLETED, $this->jobPart->getStatus()); $this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt()); $this->assertGreaterThanOrEqual($beforeTime, $this->jobPart->getCompletedAt()); $this->assertLessThanOrEqual($afterTime, $this->jobPart->getCompletedAt()); @@ -124,8 +119,8 @@ class BulkInfoProviderImportJobPartTest extends TestCase $afterTime = new \DateTimeImmutable(); $this->assertSame($this->jobPart, $result); - $this->assertEquals(BulkImportPartStatus::SKIPPED, $this->jobPart->getStatus()); - $this->assertEquals($reason, $this->jobPart->getReason()); + $this->assertSame(BulkImportPartStatus::SKIPPED, $this->jobPart->getStatus()); + $this->assertSame($reason, $this->jobPart->getReason()); $this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt()); $this->assertGreaterThanOrEqual($beforeTime, $this->jobPart->getCompletedAt()); $this->assertLessThanOrEqual($afterTime, $this->jobPart->getCompletedAt()); @@ -136,8 +131,8 @@ class BulkInfoProviderImportJobPartTest extends TestCase $result = $this->jobPart->markAsSkipped(); $this->assertSame($this->jobPart, $result); - $this->assertEquals(BulkImportPartStatus::SKIPPED, $this->jobPart->getStatus()); - $this->assertEquals('', $this->jobPart->getReason()); + $this->assertSame(BulkImportPartStatus::SKIPPED, $this->jobPart->getStatus()); + $this->assertSame('', $this->jobPart->getReason()); $this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt()); } @@ -151,8 +146,8 @@ class BulkInfoProviderImportJobPartTest extends TestCase $afterTime = new \DateTimeImmutable(); $this->assertSame($this->jobPart, $result); - $this->assertEquals(BulkImportPartStatus::FAILED, $this->jobPart->getStatus()); - $this->assertEquals($reason, $this->jobPart->getReason()); + $this->assertSame(BulkImportPartStatus::FAILED, $this->jobPart->getStatus()); + $this->assertSame($reason, $this->jobPart->getReason()); $this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt()); $this->assertGreaterThanOrEqual($beforeTime, $this->jobPart->getCompletedAt()); $this->assertLessThanOrEqual($afterTime, $this->jobPart->getCompletedAt()); @@ -163,8 +158,8 @@ class BulkInfoProviderImportJobPartTest extends TestCase $result = $this->jobPart->markAsFailed(); $this->assertSame($this->jobPart, $result); - $this->assertEquals(BulkImportPartStatus::FAILED, $this->jobPart->getStatus()); - $this->assertEquals('', $this->jobPart->getReason()); + $this->assertSame(BulkImportPartStatus::FAILED, $this->jobPart->getStatus()); + $this->assertSame('', $this->jobPart->getReason()); $this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt()); } @@ -176,7 +171,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase $result = $this->jobPart->markAsPending(); $this->assertSame($this->jobPart, $result); - $this->assertEquals(BulkImportPartStatus::PENDING, $this->jobPart->getStatus()); + $this->assertSame(BulkImportPartStatus::PENDING, $this->jobPart->getStatus()); $this->assertNull($this->jobPart->getReason()); $this->assertNull($this->jobPart->getCompletedAt()); } @@ -281,7 +276,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase // After marking as skipped, should have reason and completion time $this->jobPart->markAsSkipped('Skipped reason'); - $this->assertEquals('Skipped reason', $this->jobPart->getReason()); + $this->assertSame('Skipped reason', $this->jobPart->getReason()); $this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt()); // After marking as pending, reason and completion time should be cleared @@ -291,7 +286,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase // After marking as failed, should have reason and completion time $this->jobPart->markAsFailed('Failed reason'); - $this->assertEquals('Failed reason', $this->jobPart->getReason()); + $this->assertSame('Failed reason', $this->jobPart->getReason()); $this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt()); // After marking as completed, should have completion time (reason may remain from previous state) diff --git a/tests/Entity/BulkInfoProviderImportJobTest.php b/tests/Entity/BulkInfoProviderImportJobTest.php index c9841ac4..d1a854cd 100644 --- a/tests/Entity/BulkInfoProviderImportJobTest.php +++ b/tests/Entity/BulkInfoProviderImportJobTest.php @@ -22,6 +22,8 @@ declare(strict_types=1); namespace App\Tests\Entity; +use App\Entity\Parts\Part; +use App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultsDTO; use App\Entity\InfoProviderSystem\BulkImportJobStatus; use App\Entity\InfoProviderSystem\BulkInfoProviderImportJob; use App\Entity\UserSystem\User; @@ -31,7 +33,7 @@ use App\Services\InfoProviderSystem\DTOs\BulkSearchResponseDTO; use App\Services\InfoProviderSystem\DTOs\SearchResultDTO; use PHPUnit\Framework\TestCase; -class BulkInfoProviderImportJobTest extends TestCase +final class BulkInfoProviderImportJobTest extends TestCase { private BulkInfoProviderImportJob $job; private User $user; @@ -45,9 +47,9 @@ class BulkInfoProviderImportJobTest extends TestCase $this->job->setCreatedBy($this->user); } - private function createMockPart(int $id): \App\Entity\Parts\Part + private function createMockPart(int $id): Part { - $part = $this->createMock(\App\Entity\Parts\Part::class); + $part = $this->createMock(Part::class); $part->method('getId')->willReturn($id); $part->method('getName')->willReturn("Test Part {$id}"); return $part; @@ -58,7 +60,7 @@ class BulkInfoProviderImportJobTest extends TestCase $job = new BulkInfoProviderImportJob(); $this->assertInstanceOf(\DateTimeImmutable::class, $job->getCreatedAt()); - $this->assertEquals(BulkImportJobStatus::PENDING, $job->getStatus()); + $this->assertSame(BulkImportJobStatus::PENDING, $job->getStatus()); $this->assertEmpty($job->getPartIds()); $this->assertEmpty($job->getFieldMappings()); $this->assertEmpty($job->getSearchResultsRaw()); @@ -70,14 +72,14 @@ class BulkInfoProviderImportJobTest extends TestCase public function testBasicGettersSetters(): void { $this->job->setName('Test Job'); - $this->assertEquals('Test Job', $this->job->getName()); + $this->assertSame('Test Job', $this->job->getName()); // Test with actual parts - this is what actually works $parts = [$this->createMockPart(1), $this->createMockPart(2), $this->createMockPart(3)]; foreach ($parts as $part) { $this->job->addPart($part); } - $this->assertEquals([1, 2, 3], $this->job->getPartIds()); + $this->assertSame([1, 2, 3], $this->job->getPartIds()); $fieldMappings = [new BulkSearchFieldMappingDTO(field: 'field1', providers: ['provider1', 'provider2'])]; $this->job->setFieldMappings($fieldMappings); @@ -98,24 +100,24 @@ class BulkInfoProviderImportJobTest extends TestCase $this->assertFalse($this->job->isStopped()); $this->job->markAsInProgress(); - $this->assertEquals(BulkImportJobStatus::IN_PROGRESS, $this->job->getStatus()); + $this->assertSame(BulkImportJobStatus::IN_PROGRESS, $this->job->getStatus()); $this->assertTrue($this->job->isInProgress()); $this->assertFalse($this->job->isPending()); $this->job->markAsCompleted(); - $this->assertEquals(BulkImportJobStatus::COMPLETED, $this->job->getStatus()); + $this->assertSame(BulkImportJobStatus::COMPLETED, $this->job->getStatus()); $this->assertTrue($this->job->isCompleted()); $this->assertNotNull($this->job->getCompletedAt()); $job2 = new BulkInfoProviderImportJob(); $job2->markAsFailed(); - $this->assertEquals(BulkImportJobStatus::FAILED, $job2->getStatus()); + $this->assertSame(BulkImportJobStatus::FAILED, $job2->getStatus()); $this->assertTrue($job2->isFailed()); $this->assertNotNull($job2->getCompletedAt()); $job3 = new BulkInfoProviderImportJob(); $job3->markAsStopped(); - $this->assertEquals(BulkImportJobStatus::STOPPED, $job3->getStatus()); + $this->assertSame(BulkImportJobStatus::STOPPED, $job3->getStatus()); $this->assertTrue($job3->isStopped()); $this->assertNotNull($job3->getCompletedAt()); } @@ -139,7 +141,7 @@ class BulkInfoProviderImportJobTest extends TestCase public function testPartCount(): void { - $this->assertEquals(0, $this->job->getPartCount()); + $this->assertSame(0, $this->job->getPartCount()); // Test with actual parts - setPartIds doesn't actually add parts $parts = [ @@ -152,31 +154,31 @@ class BulkInfoProviderImportJobTest extends TestCase foreach ($parts as $part) { $this->job->addPart($part); } - $this->assertEquals(5, $this->job->getPartCount()); + $this->assertSame(5, $this->job->getPartCount()); } public function testResultCount(): void { - $this->assertEquals(0, $this->job->getResultCount()); + $this->assertSame(0, $this->job->getResultCount()); $searchResults = new BulkSearchResponseDTO([ - new \App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultsDTO( + new BulkSearchPartResultsDTO( part: $this->createMockPart(1), searchResults: [new BulkSearchPartResultDTO(searchResult: new SearchResultDTO(provider_key: 'dummy', provider_id: '1234', name: 'Part 1', description: 'A part'))] ), - new \App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultsDTO( + new BulkSearchPartResultsDTO( part: $this->createMockPart(2), searchResults: [new BulkSearchPartResultDTO(searchResult: new SearchResultDTO(provider_key: 'dummy', provider_id: '1234', name: 'Part 2', description: 'A part')), new BulkSearchPartResultDTO(searchResult: new SearchResultDTO(provider_key: 'dummy', provider_id: '5678', name: 'Part 2 Alt', description: 'Another part'))] ), - new \App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultsDTO( + new BulkSearchPartResultsDTO( part: $this->createMockPart(3), searchResults: [] ) ]); $this->job->setSearchResults($searchResults); - $this->assertEquals(3, $this->job->getResultCount()); + $this->assertSame(3, $this->job->getResultCount()); } public function testPartProgressTracking(): void @@ -222,21 +224,21 @@ class BulkInfoProviderImportJobTest extends TestCase $this->job->addPart($part); } - $this->assertEquals(0, $this->job->getCompletedPartsCount()); - $this->assertEquals(0, $this->job->getSkippedPartsCount()); + $this->assertSame(0, $this->job->getCompletedPartsCount()); + $this->assertSame(0, $this->job->getSkippedPartsCount()); $this->job->markPartAsCompleted(1); $this->job->markPartAsCompleted(2); $this->job->markPartAsSkipped(3, 'Error'); - $this->assertEquals(2, $this->job->getCompletedPartsCount()); - $this->assertEquals(1, $this->job->getSkippedPartsCount()); + $this->assertSame(2, $this->job->getCompletedPartsCount()); + $this->assertSame(1, $this->job->getSkippedPartsCount()); } public function testProgressPercentage(): void { $emptyJob = new BulkInfoProviderImportJob(); - $this->assertEquals(100.0, $emptyJob->getProgressPercentage()); + $this->assertEqualsWithDelta(100.0, $emptyJob->getProgressPercentage(), PHP_FLOAT_EPSILON); // Test with actual parts - setPartIds doesn't actually add parts $parts = [ @@ -250,18 +252,18 @@ class BulkInfoProviderImportJobTest extends TestCase $this->job->addPart($part); } - $this->assertEquals(0.0, $this->job->getProgressPercentage()); + $this->assertEqualsWithDelta(0.0, $this->job->getProgressPercentage(), PHP_FLOAT_EPSILON); $this->job->markPartAsCompleted(1); $this->job->markPartAsCompleted(2); - $this->assertEquals(40.0, $this->job->getProgressPercentage()); + $this->assertEqualsWithDelta(40.0, $this->job->getProgressPercentage(), PHP_FLOAT_EPSILON); $this->job->markPartAsSkipped(3, 'Error'); - $this->assertEquals(60.0, $this->job->getProgressPercentage()); + $this->assertEqualsWithDelta(60.0, $this->job->getProgressPercentage(), PHP_FLOAT_EPSILON); $this->job->markPartAsCompleted(4); $this->job->markPartAsCompleted(5); - $this->assertEquals(100.0, $this->job->getProgressPercentage()); + $this->assertEqualsWithDelta(100.0, $this->job->getProgressPercentage(), PHP_FLOAT_EPSILON); } public function testIsAllPartsCompleted(): void @@ -301,8 +303,8 @@ class BulkInfoProviderImportJobTest extends TestCase $this->job->addPart($part); } - $this->assertEquals('info_providers.bulk_import.job_name_template', $this->job->getDisplayNameKey()); - $this->assertEquals(['%count%' => 3], $this->job->getDisplayNameParams()); + $this->assertSame('info_providers.bulk_import.job_name_template', $this->job->getDisplayNameKey()); + $this->assertSame(['%count%' => 3], $this->job->getDisplayNameParams()); } public function testFormattedTimestamp(): void diff --git a/tests/Entity/LogSystem/AbstractLogEntryTest.php b/tests/Entity/LogSystem/AbstractLogEntryTest.php index 3f223693..d99b8e73 100644 --- a/tests/Entity/LogSystem/AbstractLogEntryTest.php +++ b/tests/Entity/LogSystem/AbstractLogEntryTest.php @@ -58,7 +58,7 @@ use App\Entity\UserSystem\Group; use App\Entity\UserSystem\User; use PHPUnit\Framework\TestCase; -class AbstractLogEntryTest extends TestCase +final class AbstractLogEntryTest extends TestCase { public function testSetGetTarget(): void { diff --git a/tests/Entity/LogSystem/LogLevelTest.php b/tests/Entity/LogSystem/LogLevelTest.php index 402942e1..0125b0cd 100644 --- a/tests/Entity/LogSystem/LogLevelTest.php +++ b/tests/Entity/LogSystem/LogLevelTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Entity\LogSystem; use App\Entity\LogSystem\LogLevel; use PHPUnit\Framework\TestCase; -class LogLevelTest extends TestCase +final class LogLevelTest extends TestCase { public function testToPSR3LevelString(): void diff --git a/tests/Entity/LogSystem/LogTargetTypeTest.php b/tests/Entity/LogSystem/LogTargetTypeTest.php index 46682496..06e2ead1 100644 --- a/tests/Entity/LogSystem/LogTargetTypeTest.php +++ b/tests/Entity/LogSystem/LogTargetTypeTest.php @@ -30,7 +30,7 @@ use App\Entity\Parts\Category; use App\Entity\UserSystem\User; use PHPUnit\Framework\TestCase; -class LogTargetTypeTest extends TestCase +final class LogTargetTypeTest extends TestCase { public function testToClass(): void diff --git a/tests/Entity/Parameters/PartParameterTest.php b/tests/Entity/Parameters/PartParameterTest.php index 64550eee..6a07468e 100644 --- a/tests/Entity/Parameters/PartParameterTest.php +++ b/tests/Entity/Parameters/PartParameterTest.php @@ -45,7 +45,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Entity\Parameters\PartParameter; use PHPUnit\Framework\TestCase; -class PartParameterTest extends TestCase +final class PartParameterTest extends TestCase { public static function valueWithUnitDataProvider(): \Iterator { diff --git a/tests/Entity/Parts/InfoProviderReferenceTest.php b/tests/Entity/Parts/InfoProviderReferenceTest.php index a1a8d5de..dcc6a43c 100644 --- a/tests/Entity/Parts/InfoProviderReferenceTest.php +++ b/tests/Entity/Parts/InfoProviderReferenceTest.php @@ -26,7 +26,7 @@ use App\Entity\Parts\InfoProviderReference; use App\Services\InfoProviderSystem\DTOs\PartDetailDTO; use PHPUnit\Framework\TestCase; -class InfoProviderReferenceTest extends TestCase +final class InfoProviderReferenceTest extends TestCase { public function testNoProvider(): void { diff --git a/tests/Entity/Parts/PartAssociationTest.php b/tests/Entity/Parts/PartAssociationTest.php index e002846e..25487d1f 100644 --- a/tests/Entity/Parts/PartAssociationTest.php +++ b/tests/Entity/Parts/PartAssociationTest.php @@ -26,7 +26,7 @@ use App\Entity\Parts\AssociationType; use App\Entity\Parts\PartAssociation; use PHPUnit\Framework\TestCase; -class PartAssociationTest extends TestCase +final class PartAssociationTest extends TestCase { public function testGetTypeTranslationKey(): void diff --git a/tests/Entity/Parts/PartLotTest.php b/tests/Entity/Parts/PartLotTest.php index 30687b72..10cc80b9 100644 --- a/tests/Entity/Parts/PartLotTest.php +++ b/tests/Entity/Parts/PartLotTest.php @@ -26,7 +26,7 @@ use App\Entity\Parts\PartLot; use DateTime; use PHPUnit\Framework\TestCase; -class PartLotTest extends TestCase +final class PartLotTest extends TestCase { public function testIsExpired(): void { diff --git a/tests/Entity/Parts/PartTest.php b/tests/Entity/Parts/PartTest.php index c1ae8935..e855c340 100644 --- a/tests/Entity/Parts/PartTest.php +++ b/tests/Entity/Parts/PartTest.php @@ -29,7 +29,7 @@ use DateTime; use Doctrine\Common\Collections\Collection; use PHPUnit\Framework\TestCase; -class PartTest extends TestCase +final class PartTest extends TestCase { public function testAddRemovePartLot(): void { diff --git a/tests/Entity/PriceSystem/CurrencyTest.php b/tests/Entity/PriceSystem/CurrencyTest.php index 0058d501..018092e5 100644 --- a/tests/Entity/PriceSystem/CurrencyTest.php +++ b/tests/Entity/PriceSystem/CurrencyTest.php @@ -26,7 +26,7 @@ use App\Entity\PriceInformations\Currency; use Brick\Math\BigDecimal; use PHPUnit\Framework\TestCase; -class CurrencyTest extends TestCase +final class CurrencyTest extends TestCase { public function testGetInverseExchangeRate(): void { diff --git a/tests/Entity/PriceSystem/OrderdetailTest.php b/tests/Entity/PriceSystem/OrderdetailTest.php index df86ab34..2becb74e 100644 --- a/tests/Entity/PriceSystem/OrderdetailTest.php +++ b/tests/Entity/PriceSystem/OrderdetailTest.php @@ -27,7 +27,7 @@ use App\Entity\PriceInformations\Pricedetail; use Doctrine\Common\Collections\Collection; use PHPUnit\Framework\TestCase; -class OrderdetailTest extends TestCase +final class OrderdetailTest extends TestCase { public function testAddRemovePricdetails(): void { diff --git a/tests/Entity/PriceSystem/PricedetailTest.php b/tests/Entity/PriceSystem/PricedetailTest.php index 8a3cf328..effe6fd6 100644 --- a/tests/Entity/PriceSystem/PricedetailTest.php +++ b/tests/Entity/PriceSystem/PricedetailTest.php @@ -28,7 +28,7 @@ use App\Entity\PriceInformations\Pricedetail; use Brick\Math\BigDecimal; use PHPUnit\Framework\TestCase; -class PricedetailTest extends TestCase +final class PricedetailTest extends TestCase { public function testGetPricePerUnit(): void { diff --git a/tests/Entity/UserSystem/ApiTokenTypeTest.php b/tests/Entity/UserSystem/ApiTokenTypeTest.php index a8e520f1..7a4506ba 100644 --- a/tests/Entity/UserSystem/ApiTokenTypeTest.php +++ b/tests/Entity/UserSystem/ApiTokenTypeTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Entity\UserSystem; use App\Entity\UserSystem\ApiTokenType; use PHPUnit\Framework\TestCase; -class ApiTokenTypeTest extends TestCase +final class ApiTokenTypeTest extends TestCase { public function testGetTokenPrefix(): void diff --git a/tests/Entity/UserSystem/PermissionDataTest.php b/tests/Entity/UserSystem/PermissionDataTest.php index 4fd8c5ce..3d250a81 100644 --- a/tests/Entity/UserSystem/PermissionDataTest.php +++ b/tests/Entity/UserSystem/PermissionDataTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Entity\UserSystem; use App\Entity\UserSystem\PermissionData; use PHPUnit\Framework\TestCase; -class PermissionDataTest extends TestCase +final class PermissionDataTest extends TestCase { public function testGetSetIs(): void diff --git a/tests/Entity/UserSystem/UserTest.php b/tests/Entity/UserSystem/UserTest.php index a4349e1d..12797ad1 100644 --- a/tests/Entity/UserSystem/UserTest.php +++ b/tests/Entity/UserSystem/UserTest.php @@ -31,7 +31,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Uid\Uuid; use Webauthn\TrustPath\EmptyTrustPath; -class UserTest extends TestCase +final class UserTest extends TestCase { public function testGetFullName(): void { diff --git a/tests/EnvVarProcessors/AddSlashEnvVarProcessorTest.php b/tests/EnvVarProcessors/AddSlashEnvVarProcessorTest.php index 4099f0ee..c4c9f04b 100644 --- a/tests/EnvVarProcessors/AddSlashEnvVarProcessorTest.php +++ b/tests/EnvVarProcessors/AddSlashEnvVarProcessorTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\EnvVarProcessors; use App\EnvVarProcessors\AddSlashEnvVarProcessor; use PHPUnit\Framework\TestCase; -class AddSlashEnvVarProcessorTest extends TestCase +final class AddSlashEnvVarProcessorTest extends TestCase { protected AddSlashEnvVarProcessor $processor; diff --git a/tests/EventListener/RegisterSynonymsAsTranslationParametersTest.php b/tests/EventListener/RegisterSynonymsAsTranslationParametersTest.php index 58573ae6..3a35c670 100644 --- a/tests/EventListener/RegisterSynonymsAsTranslationParametersTest.php +++ b/tests/EventListener/RegisterSynonymsAsTranslationParametersTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\EventListener; use App\EventListener\RegisterSynonymsAsTranslationParametersListener; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -class RegisterSynonymsAsTranslationParametersTest extends KernelTestCase +final class RegisterSynonymsAsTranslationParametersTest extends KernelTestCase { private RegisterSynonymsAsTranslationParametersListener $listener; diff --git a/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php b/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php index 0eaf931c..3d2089e1 100644 --- a/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php +++ b/tests/EventSubscriber/PasswordChangeNeededSubscriberTest.php @@ -33,7 +33,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\Uid\Uuid; use Webauthn\TrustPath\EmptyTrustPath; -class PasswordChangeNeededSubscriberTest extends TestCase +final class PasswordChangeNeededSubscriberTest extends TestCase { public function testTFARedirectNeeded(): void { diff --git a/tests/Exceptions/TwigModeExceptionTest.php b/tests/Exceptions/TwigModeExceptionTest.php index 686a87a2..09468291 100644 --- a/tests/Exceptions/TwigModeExceptionTest.php +++ b/tests/Exceptions/TwigModeExceptionTest.php @@ -27,7 +27,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Twig\Error\Error; -class TwigModeExceptionTest extends KernelTestCase +final class TwigModeExceptionTest extends KernelTestCase { private string $projectPath; diff --git a/tests/Form/InfoProviderSystem/GlobalFieldMappingTypeTest.php b/tests/Form/InfoProviderSystem/GlobalFieldMappingTypeTest.php index 89e362e4..07106505 100644 --- a/tests/Form/InfoProviderSystem/GlobalFieldMappingTypeTest.php +++ b/tests/Form/InfoProviderSystem/GlobalFieldMappingTypeTest.php @@ -29,7 +29,7 @@ use Symfony\Component\Form\FormFactoryInterface; #[Group("slow")] #[Group("DB")] -class GlobalFieldMappingTypeTest extends KernelTestCase +final class GlobalFieldMappingTypeTest extends KernelTestCase { private FormFactoryInterface $formFactory; diff --git a/tests/Helpers/BBCodeToMarkdownConverterTest.php b/tests/Helpers/BBCodeToMarkdownConverterTest.php index 9506cba4..07fca505 100644 --- a/tests/Helpers/BBCodeToMarkdownConverterTest.php +++ b/tests/Helpers/BBCodeToMarkdownConverterTest.php @@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Helpers\BBCodeToMarkdownConverter; use PHPUnit\Framework\TestCase; -class BBCodeToMarkdownConverterTest extends TestCase +final class BBCodeToMarkdownConverterTest extends TestCase { protected BBCodeToMarkdownConverter $converter; diff --git a/tests/Helpers/IPAnonymizerTest.php b/tests/Helpers/IPAnonymizerTest.php index e16368eb..7efd27ac 100644 --- a/tests/Helpers/IPAnonymizerTest.php +++ b/tests/Helpers/IPAnonymizerTest.php @@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Helpers\IPAnonymizer; use PHPUnit\Framework\TestCase; -class IPAnonymizerTest extends TestCase +final class IPAnonymizerTest extends TestCase { public static function anonymizeDataProvider(): \Generator diff --git a/tests/Helpers/Projects/ProjectBuildRequestTest.php b/tests/Helpers/Projects/ProjectBuildRequestTest.php index 1158d89a..c1fd1498 100644 --- a/tests/Helpers/Projects/ProjectBuildRequestTest.php +++ b/tests/Helpers/Projects/ProjectBuildRequestTest.php @@ -30,7 +30,7 @@ use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Helpers\Projects\ProjectBuildRequest; use PHPUnit\Framework\TestCase; -class ProjectBuildRequestTest extends TestCase +final class ProjectBuildRequestTest extends TestCase { /** @var Project */ diff --git a/tests/Helpers/TreeViewNodeTest.php b/tests/Helpers/TreeViewNodeTest.php index 9005651d..b1179f6c 100644 --- a/tests/Helpers/TreeViewNodeTest.php +++ b/tests/Helpers/TreeViewNodeTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Helpers; use App\Helpers\Trees\TreeViewNode; use PHPUnit\Framework\TestCase; -class TreeViewNodeTest extends TestCase +final class TreeViewNodeTest extends TestCase { /** * @var TreeViewNode diff --git a/tests/Helpers/TrinaryLogicHelperTest.php b/tests/Helpers/TrinaryLogicHelperTest.php index 3082571b..4b8c9f01 100644 --- a/tests/Helpers/TrinaryLogicHelperTest.php +++ b/tests/Helpers/TrinaryLogicHelperTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Helpers; use App\Helpers\TrinaryLogicHelper; use PHPUnit\Framework\TestCase; -class TrinaryLogicHelperTest extends TestCase +final class TrinaryLogicHelperTest extends TestCase { public function testNot() diff --git a/tests/Repository/AttachmentContainingDBElementRepositoryTest.php b/tests/Repository/AttachmentContainingDBElementRepositoryTest.php index f61750d9..38aca071 100644 --- a/tests/Repository/AttachmentContainingDBElementRepositoryTest.php +++ b/tests/Repository/AttachmentContainingDBElementRepositoryTest.php @@ -28,7 +28,7 @@ use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -class AttachmentContainingDBElementRepositoryTest extends KernelTestCase +final class AttachmentContainingDBElementRepositoryTest extends KernelTestCase { private EntityManagerInterface $entityManager; diff --git a/tests/Repository/DBElementRepositoryTest.php b/tests/Repository/DBElementRepositoryTest.php index 05ede7e2..5f1ac0e1 100644 --- a/tests/Repository/DBElementRepositoryTest.php +++ b/tests/Repository/DBElementRepositoryTest.php @@ -33,7 +33,7 @@ use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -class DBElementRepositoryTest extends KernelTestCase +final class DBElementRepositoryTest extends KernelTestCase { private EntityManagerInterface $entityManager; diff --git a/tests/Repository/LogEntryRepositoryTest.php b/tests/Repository/LogEntryRepositoryTest.php index f6cc991d..46093a9e 100644 --- a/tests/Repository/LogEntryRepositoryTest.php +++ b/tests/Repository/LogEntryRepositoryTest.php @@ -33,7 +33,7 @@ use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -class LogEntryRepositoryTest extends KernelTestCase +final class LogEntryRepositoryTest extends KernelTestCase { private EntityManagerInterface $entityManager; @@ -75,6 +75,7 @@ class LogEntryRepositoryTest extends KernelTestCase //We have a edit log entry for the category with ID 1 $category = $this->entityManager->find(Category::class, 1); $adminUser = $this->entityManager->getRepository(User::class)->findOneBy(['name' => 'admin']); + $this->assertInstanceOf(Category::class, $category); $user = $this->repo->getLastEditingUser($category); @@ -83,6 +84,7 @@ class LogEntryRepositoryTest extends KernelTestCase //For the category 2, the user must be null $category = $this->entityManager->find(Category::class, 2); + $this->assertInstanceOf(Category::class, $category); $user = $this->repo->getLastEditingUser($category); $this->assertNull($user); } @@ -92,6 +94,7 @@ class LogEntryRepositoryTest extends KernelTestCase //We have a edit log entry for the category with ID 1 $category = $this->entityManager->find(Category::class, 1); $adminUser = $this->entityManager->getRepository(User::class)->findOneBy(['name' => 'admin']); + $this->assertInstanceOf(Category::class, $category); $user = $this->repo->getCreatingUser($category); @@ -100,6 +103,7 @@ class LogEntryRepositoryTest extends KernelTestCase //For the category 2, the user must be null $category = $this->entityManager->find(Category::class, 2); + $this->assertInstanceOf(Category::class, $category); $user = $this->repo->getCreatingUser($category); $this->assertNull($user); } @@ -119,6 +123,7 @@ class LogEntryRepositoryTest extends KernelTestCase public function testGetElementExistedAtTimestamp(): void { $part = $this->entityManager->find(Part::class, 3); + $this->assertInstanceOf(Part::class, $part); //Assume that the part is existing now $this->assertTrue($this->repo->getElementExistedAtTimestamp($part, new \DateTimeImmutable())); @@ -130,6 +135,7 @@ class LogEntryRepositoryTest extends KernelTestCase public function testGetElementHistory(): void { $category = $this->entityManager->find(Category::class, 1); + $this->assertInstanceOf(Category::class, $category); $history = $this->repo->getElementHistory($category); @@ -141,6 +147,7 @@ class LogEntryRepositoryTest extends KernelTestCase public function testGetTimetravelDataForElement(): void { $category = $this->entityManager->find(Category::class, 1); + $this->assertInstanceOf(Category::class, $category); $data = $this->repo->getTimetravelDataForElement($category, new \DateTimeImmutable('2020-01-01')); //The data must contain only ElementChangedLogEntry diff --git a/tests/Repository/NamedDBElementRepositoryTest.php b/tests/Repository/NamedDBElementRepositoryTest.php index 117d7d0e..dc8b2a5c 100644 --- a/tests/Repository/NamedDBElementRepositoryTest.php +++ b/tests/Repository/NamedDBElementRepositoryTest.php @@ -30,7 +30,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; /** * @Group DB */ -class NamedDBElementRepositoryTest extends WebTestCase +final class NamedDBElementRepositoryTest extends WebTestCase { /** * @var StructuralDBElementRepository diff --git a/tests/Repository/PartRepositoryTest.php b/tests/Repository/PartRepositoryTest.php index 68b75abb..c2e7858a 100644 --- a/tests/Repository/PartRepositoryTest.php +++ b/tests/Repository/PartRepositoryTest.php @@ -60,8 +60,8 @@ final class PartRepositoryTest extends TestCase $classMetadata = new ClassMetadata(Part::class); $emMock->method('getClassMetadata')->with(Part::class)->willReturn($classMetadata); - $translatorMock = $this->createMock(TranslatorInterface::class); - $ipnSuggestSettings = $this->createMock(IpnSuggestSettings::class); + $translatorMock = $this->createStub(TranslatorInterface::class); + $ipnSuggestSettings = $this->createStub(IpnSuggestSettings::class); $repo = $this->getMockBuilder(PartRepository::class) ->setConstructorArgs([$emMock, $translatorMock, $ipnSuggestSettings]) @@ -120,7 +120,7 @@ final class PartRepositoryTest extends TestCase return $id; }); - $ipnSuggestSettings = $this->createMock(IpnSuggestSettings::class); + $ipnSuggestSettings = $this->createStub(IpnSuggestSettings::class); $ipnSuggestSettings->suggestPartDigits = 4; $ipnSuggestSettings->useDuplicateDescription = false; @@ -204,7 +204,7 @@ final class PartRepositoryTest extends TestCase return $id; }); - $ipnSuggestSettings = $this->createMock(IpnSuggestSettings::class); + $ipnSuggestSettings = $this->createStub(IpnSuggestSettings::class); $ipnSuggestSettings->suggestPartDigits = 4; $ipnSuggestSettings->useDuplicateDescription = false; diff --git a/tests/Repository/StructuralDBElementRepositoryTest.php b/tests/Repository/StructuralDBElementRepositoryTest.php index 5ab8b788..16e92837 100644 --- a/tests/Repository/StructuralDBElementRepositoryTest.php +++ b/tests/Repository/StructuralDBElementRepositoryTest.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Tests\Repository; +use App\Entity\Base\AbstractStructuralDBElement; use App\Entity\Attachments\AttachmentType; use App\Helpers\Trees\TreeViewNode; use App\Repository\StructuralDBElementRepository; @@ -30,7 +31,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; /** * @Group DB */ -class StructuralDBElementRepositoryTest extends WebTestCase +final class StructuralDBElementRepositoryTest extends WebTestCase { /** * @var StructuralDBElementRepository @@ -108,6 +109,7 @@ class StructuralDBElementRepositoryTest extends WebTestCase { //List all nodes that are children to Node 1 $node1 = $this->repo->find(1); + $this->assertInstanceOf(AbstractStructuralDBElement::class, $node1); $nodes = $this->repo->getFlatList($node1); $this->assertCount(3, $nodes); diff --git a/tests/Repository/UserRepositoryTest.php b/tests/Repository/UserRepositoryTest.php index 67a77aea..24a2d657 100644 --- a/tests/Repository/UserRepositoryTest.php +++ b/tests/Repository/UserRepositoryTest.php @@ -27,7 +27,7 @@ use App\Repository\UserRepository; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class UserRepositoryTest extends WebTestCase +final class UserRepositoryTest extends WebTestCase { /** diff --git a/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php b/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php index c9a14426..2fedf108 100644 --- a/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php +++ b/tests/Security/EnsureSAMLUserForSAMLLoginCheckerTest.php @@ -30,7 +30,7 @@ use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent; use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException; -class EnsureSAMLUserForSAMLLoginCheckerTest extends WebTestCase +final class EnsureSAMLUserForSAMLLoginCheckerTest extends WebTestCase { /** @var EnsureSAMLUserForSAMLLoginChecker */ protected $service; diff --git a/tests/Security/SamlUserFactoryTest.php b/tests/Security/SamlUserFactoryTest.php index 7780b4be..b975ca0d 100644 --- a/tests/Security/SamlUserFactoryTest.php +++ b/tests/Security/SamlUserFactoryTest.php @@ -26,7 +26,7 @@ use App\Entity\UserSystem\User; use App\Security\SamlUserFactory; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class SamlUserFactoryTest extends WebTestCase +final class SamlUserFactoryTest extends WebTestCase { /** @var SamlUserFactory */ diff --git a/tests/Security/UserCheckerTest.php b/tests/Security/UserCheckerTest.php index 35c2e1e5..e32d5bfe 100644 --- a/tests/Security/UserCheckerTest.php +++ b/tests/Security/UserCheckerTest.php @@ -27,7 +27,7 @@ use App\Security\UserChecker; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException; -class UserCheckerTest extends WebTestCase +final class UserCheckerTest extends WebTestCase { protected $service; diff --git a/tests/Serializer/BigNumberNormalizerTest.php b/tests/Serializer/BigNumberNormalizerTest.php index f64347ee..509d6352 100644 --- a/tests/Serializer/BigNumberNormalizerTest.php +++ b/tests/Serializer/BigNumberNormalizerTest.php @@ -29,7 +29,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Brick\Math\BigDecimal; use Brick\Math\BigNumber; -class BigNumberNormalizerTest extends WebTestCase +final class BigNumberNormalizerTest extends WebTestCase { /** @var BigNumberNormalizer */ protected $service; diff --git a/tests/Serializer/PartNormalizerTest.php b/tests/Serializer/PartNormalizerTest.php index 9baff750..2f07f36d 100644 --- a/tests/Serializer/PartNormalizerTest.php +++ b/tests/Serializer/PartNormalizerTest.php @@ -31,7 +31,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class PartNormalizerTest extends WebTestCase +final class PartNormalizerTest extends WebTestCase { /** @var PartNormalizer */ protected DenormalizerInterface&NormalizerInterface $service; diff --git a/tests/Serializer/StructuralElementDenormalizerTest.php b/tests/Serializer/StructuralElementDenormalizerTest.php index 31c9f0bb..e8e46611 100644 --- a/tests/Serializer/StructuralElementDenormalizerTest.php +++ b/tests/Serializer/StructuralElementDenormalizerTest.php @@ -27,7 +27,7 @@ use App\Entity\Parts\Category; use App\Serializer\StructuralElementDenormalizer; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class StructuralElementDenormalizerTest extends WebTestCase +final class StructuralElementDenormalizerTest extends WebTestCase { /** @var StructuralElementDenormalizer */ diff --git a/tests/Serializer/StructuralElementFromNameDenormalizerTest.php b/tests/Serializer/StructuralElementFromNameDenormalizerTest.php index b344508c..b4bdcdac 100644 --- a/tests/Serializer/StructuralElementFromNameDenormalizerTest.php +++ b/tests/Serializer/StructuralElementFromNameDenormalizerTest.php @@ -26,7 +26,7 @@ use App\Entity\Parts\Category; use App\Serializer\StructuralElementFromNameDenormalizer; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class StructuralElementFromNameDenormalizerTest extends WebTestCase +final class StructuralElementFromNameDenormalizerTest extends WebTestCase { /** @var StructuralElementFromNameDenormalizer */ diff --git a/tests/Serializer/StructuralElementNormalizerTest.php b/tests/Serializer/StructuralElementNormalizerTest.php index 79f739fa..4b335bcd 100644 --- a/tests/Serializer/StructuralElementNormalizerTest.php +++ b/tests/Serializer/StructuralElementNormalizerTest.php @@ -30,7 +30,7 @@ use App\Serializer\StructuralElementNormalizer; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class StructuralElementNormalizerTest extends WebTestCase +final class StructuralElementNormalizerTest extends WebTestCase { /** @var StructuralElementNormalizer */ diff --git a/tests/Services/Attachments/AttachmentPathResolverTest.php b/tests/Services/Attachments/AttachmentPathResolverTest.php index 69658e13..b145e482 100644 --- a/tests/Services/Attachments/AttachmentPathResolverTest.php +++ b/tests/Services/Attachments/AttachmentPathResolverTest.php @@ -28,10 +28,8 @@ use App\Services\Attachments\AttachmentPathResolver; use const DIRECTORY_SEPARATOR; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class AttachmentPathResolverTest extends WebTestCase +final class AttachmentPathResolverTest extends WebTestCase { - protected string $media_path; - protected string $footprint_path; protected $projectDir_orig; protected $projectDir; /** @@ -46,8 +44,8 @@ class AttachmentPathResolverTest extends WebTestCase $this->projectDir_orig = realpath(self::$kernel->getProjectDir()); $this->projectDir = str_replace('\\', '/', $this->projectDir_orig); - $this->media_path = $this->projectDir.'/public/media'; - $this->footprint_path = $this->projectDir.'/public/img/footprints'; + $media_path = $this->projectDir.'/public/media'; + $footprint_path = $this->projectDir.'/public/img/footprints'; $this->service = self::getContainer()->get(AttachmentPathResolver::class); } diff --git a/tests/Services/Attachments/AttachmentURLGeneratorTest.php b/tests/Services/Attachments/AttachmentURLGeneratorTest.php index e9e6d992..4359c1b9 100644 --- a/tests/Services/Attachments/AttachmentURLGeneratorTest.php +++ b/tests/Services/Attachments/AttachmentURLGeneratorTest.php @@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Services\Attachments\AttachmentURLGenerator; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class AttachmentURLGeneratorTest extends WebTestCase +final class AttachmentURLGeneratorTest extends WebTestCase { protected const PUBLIC_DIR = '/public'; diff --git a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php index 80c699ac..5198ddea 100644 --- a/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php +++ b/tests/Services/Attachments/BuiltinAttachmentsFinderTest.php @@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Services\Attachments\BuiltinAttachmentsFinder; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class BuiltinAttachmentsFinderTest extends WebTestCase +final class BuiltinAttachmentsFinderTest extends WebTestCase { protected static array $mock_list = [ '%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS%/123.jpg', '%FOOTPRINTS%/123.jpeg', diff --git a/tests/Services/Attachments/FileTypeFilterToolsTest.php b/tests/Services/Attachments/FileTypeFilterToolsTest.php index 1b85eaeb..f089feec 100644 --- a/tests/Services/Attachments/FileTypeFilterToolsTest.php +++ b/tests/Services/Attachments/FileTypeFilterToolsTest.php @@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Services\Attachments\FileTypeFilterTools; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class FileTypeFilterToolsTest extends WebTestCase +final class FileTypeFilterToolsTest extends WebTestCase { protected static $service; diff --git a/tests/Services/ElementTypeNameGeneratorTest.php b/tests/Services/ElementTypeNameGeneratorTest.php index 8739dd06..21797137 100644 --- a/tests/Services/ElementTypeNameGeneratorTest.php +++ b/tests/Services/ElementTypeNameGeneratorTest.php @@ -35,7 +35,7 @@ use App\Services\Formatters\AmountFormatter; use App\Settings\SynonymSettings; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class ElementTypeNameGeneratorTest extends WebTestCase +final class ElementTypeNameGeneratorTest extends WebTestCase { protected ElementTypeNameGenerator $service; private SynonymSettings $synonymSettings; diff --git a/tests/Services/ElementTypesTest.php b/tests/Services/ElementTypesTest.php index d4fa77ff..15e5d8bb 100644 --- a/tests/Services/ElementTypesTest.php +++ b/tests/Services/ElementTypesTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Services; use App\Entity\Parameters\CategoryParameter; @@ -26,7 +28,7 @@ use App\Exceptions\EntityNotSupportedException; use App\Services\ElementTypes; use PHPUnit\Framework\TestCase; -class ElementTypesTest extends TestCase +final class ElementTypesTest extends TestCase { public function testFromClass(): void diff --git a/tests/Services/EntityMergers/Mergers/EntityMergerHelperTraitTest.php b/tests/Services/EntityMergers/Mergers/EntityMergerHelperTraitTest.php index 22fa220b..f5fd8334 100644 --- a/tests/Services/EntityMergers/Mergers/EntityMergerHelperTraitTest.php +++ b/tests/Services/EntityMergers/Mergers/EntityMergerHelperTraitTest.php @@ -28,7 +28,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\PropertyAccess\PropertyAccessorInterface; -class EntityMergerHelperTraitTest extends KernelTestCase +final class EntityMergerHelperTraitTest extends KernelTestCase { use EntityMergerHelperTrait; diff --git a/tests/Services/EntityMergers/Mergers/PartMergerTest.php b/tests/Services/EntityMergers/Mergers/PartMergerTest.php index 7db4ddd6..f6a75790 100644 --- a/tests/Services/EntityMergers/Mergers/PartMergerTest.php +++ b/tests/Services/EntityMergers/Mergers/PartMergerTest.php @@ -36,7 +36,7 @@ use App\Services\EntityMergers\Mergers\PartMerger; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -class PartMergerTest extends KernelTestCase +final class PartMergerTest extends KernelTestCase { /** @var PartMerger|null */ diff --git a/tests/Services/Formatters/AmountFormatterTest.php b/tests/Services/Formatters/AmountFormatterTest.php index 40f9b7cf..9fdeb441 100644 --- a/tests/Services/Formatters/AmountFormatterTest.php +++ b/tests/Services/Formatters/AmountFormatterTest.php @@ -27,7 +27,7 @@ use App\Services\Formatters\AmountFormatter; use InvalidArgumentException; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class AmountFormatterTest extends WebTestCase +final class AmountFormatterTest extends WebTestCase { /** * @var AmountFormatter diff --git a/tests/Services/Formatters/SIFormatterTest.php b/tests/Services/Formatters/SIFormatterTest.php index 79668589..62ca0187 100644 --- a/tests/Services/Formatters/SIFormatterTest.php +++ b/tests/Services/Formatters/SIFormatterTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Services\Formatters; use App\Services\Formatters\SIFormatter; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class SIFormatterTest extends WebTestCase +final class SIFormatterTest extends WebTestCase { /** * @var SIFormatter diff --git a/tests/Services/ImportExportSystem/BOMImporterTest.php b/tests/Services/ImportExportSystem/BOMImporterTest.php index a8841f17..5a9d4121 100644 --- a/tests/Services/ImportExportSystem/BOMImporterTest.php +++ b/tests/Services/ImportExportSystem/BOMImporterTest.php @@ -22,6 +22,8 @@ declare(strict_types=1); */ namespace App\Tests\Services\ImportExportSystem; +use App\Entity\PriceInformations\Orderdetail; +use App\Entity\Parts\Category; use App\Entity\Parts\Part; use App\Entity\Parts\Supplier; use App\Entity\ProjectSystem\Project; @@ -31,7 +33,7 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\HttpFoundation\File\File; -class BOMImporterTest extends WebTestCase +final class BOMImporterTest extends WebTestCase { /** @@ -391,7 +393,7 @@ class BOMImporterTest extends WebTestCase // Check first entry $this->assertEquals('R1,R2', $bom_entries[0]->getMountnames()); - $this->assertEquals(2.0, $bom_entries[0]->getQuantity()); + $this->assertEqualsWithDelta(2.0, $bom_entries[0]->getQuantity(), PHP_FLOAT_EPSILON); $this->assertEquals('CRCW080510K0FKEA (R_0805_2012Metric)', $bom_entries[0]->getName()); $this->assertStringContainsString('Value: 10k', $bom_entries[0]->getComment()); $this->assertStringContainsString('MPN: CRCW080510K0FKEA', $bom_entries[0]->getComment()); @@ -402,7 +404,7 @@ class BOMImporterTest extends WebTestCase // Check second entry $this->assertEquals('C1', $bom_entries[1]->getMountnames()); - $this->assertEquals(1.0, $bom_entries[1]->getQuantity()); + $this->assertEqualsWithDelta(1.0, $bom_entries[1]->getQuantity(), PHP_FLOAT_EPSILON); $this->assertStringContainsString('LCSC SPN: C789012', $bom_entries[1]->getComment()); $this->assertStringContainsString('Mouser SPN: 80-CL21A104KOCLRNC', $bom_entries[1]->getComment()); @@ -542,7 +544,7 @@ class BOMImporterTest extends WebTestCase $this->assertCount(1, $bom_entries); // Should merge into one entry $this->assertEquals('R1,R2', $bom_entries[0]->getMountnames()); - $this->assertEquals(2.0, $bom_entries[0]->getQuantity()); + $this->assertEqualsWithDelta(2.0, $bom_entries[0]->getQuantity(), PHP_FLOAT_EPSILON); $this->assertEquals('CRCW080510K0FKEA', $bom_entries[0]->getName()); } @@ -630,7 +632,7 @@ class BOMImporterTest extends WebTestCase $this->entityManager->persist($part); // Create orderdetail linking the part to a supplier SPN - $orderdetail = new \App\Entity\PriceInformations\Orderdetail(); + $orderdetail = new Orderdetail(); $orderdetail->setPart($part); $orderdetail->setSupplier($lcscSupplier); $orderdetail->setSupplierpartnr('C123456'); @@ -664,7 +666,7 @@ class BOMImporterTest extends WebTestCase $this->assertSame($part, $bom_entries[0]->getPart()); $this->assertEquals('Test Resistor 10k 0805', $bom_entries[0]->getName()); $this->assertEquals('R1,R2', $bom_entries[0]->getMountnames()); - $this->assertEquals(2.0, $bom_entries[0]->getQuantity()); + $this->assertEqualsWithDelta(2.0, $bom_entries[0]->getQuantity(), PHP_FLOAT_EPSILON); $this->assertStringContainsString('LCSC SPN: C123456', $bom_entries[0]->getComment()); $this->assertStringContainsString('Part-DB ID: ' . $part->getID(), $bom_entries[0]->getComment()); @@ -691,7 +693,7 @@ class BOMImporterTest extends WebTestCase $part1->setCategory($this->getDefaultCategory($this->entityManager)); $this->entityManager->persist($part1); - $orderdetail1 = new \App\Entity\PriceInformations\Orderdetail(); + $orderdetail1 = new Orderdetail(); $orderdetail1->setPart($part1); $orderdetail1->setSupplier($lcscSupplier); $orderdetail1->setSupplierpartnr('C123456'); @@ -703,7 +705,7 @@ class BOMImporterTest extends WebTestCase $part2->setCategory($this->getDefaultCategory($this->entityManager)); $this->entityManager->persist($part2); - $orderdetail2 = new \App\Entity\PriceInformations\Orderdetail(); + $orderdetail2 = new Orderdetail(); $orderdetail2->setPart($part2); $orderdetail2->setSupplier($mouserSupplier); $orderdetail2->setSupplierpartnr('789-CAP100NF'); @@ -794,12 +796,12 @@ class BOMImporterTest extends WebTestCase private function getDefaultCategory(EntityManagerInterface $entityManager) { // Get the first available category or create a default one - $categoryRepo = $entityManager->getRepository(\App\Entity\Parts\Category::class); + $categoryRepo = $entityManager->getRepository(Category::class); $categories = $categoryRepo->findAll(); if (empty($categories)) { // Create a default category if none exists - $category = new \App\Entity\Parts\Category(); + $category = new Category(); $category->setName('Default Category'); $entityManager->persist($category); $entityManager->flush(); diff --git a/tests/Services/ImportExportSystem/BOMValidationServiceTest.php b/tests/Services/ImportExportSystem/BOMValidationServiceTest.php index 055db8b4..a6c103db 100644 --- a/tests/Services/ImportExportSystem/BOMValidationServiceTest.php +++ b/tests/Services/ImportExportSystem/BOMValidationServiceTest.php @@ -32,18 +32,16 @@ use Symfony\Contracts\Translation\TranslatorInterface; /** * @see \App\Services\ImportExportSystem\BOMValidationService */ -class BOMValidationServiceTest extends WebTestCase +final class BOMValidationServiceTest extends WebTestCase { private BOMValidationService $validationService; - private EntityManagerInterface $entityManager; - private TranslatorInterface $translator; protected function setUp(): void { self::bootKernel(); - $this->entityManager = self::getContainer()->get(EntityManagerInterface::class); - $this->translator = self::getContainer()->get(TranslatorInterface::class); - $this->validationService = new BOMValidationService($this->entityManager, $this->translator); + $entityManager = self::getContainer()->get(EntityManagerInterface::class); + $translator = self::getContainer()->get(TranslatorInterface::class); + $this->validationService = new BOMValidationService($entityManager, $translator); } public function testValidateBOMEntryWithValidData(): void @@ -244,7 +242,7 @@ class BOMValidationServiceTest extends WebTestCase $this->assertTrue($result['is_valid']); $this->assertCount(1, $result['info']); - $this->assertStringContainsString('library prefix', $result['info'][0]); + $this->assertStringContainsString('library prefix', (string) $result['info'][0]); } public function testValidateBOMEntriesWithMultipleEntries(): void @@ -314,7 +312,7 @@ class BOMValidationServiceTest extends WebTestCase $this->assertEquals(2, $stats['error_count']); $this->assertEquals(1, $stats['warning_count']); $this->assertEquals(2, $stats['info_count']); - $this->assertEquals(80.0, $stats['success_rate']); + $this->assertEqualsWithDelta(80.0, $stats['success_rate'], PHP_FLOAT_EPSILON); } public function testGetErrorMessage(): void @@ -344,6 +342,6 @@ class BOMValidationServiceTest extends WebTestCase $message = $this->validationService->getErrorMessage($validation_result); - $this->assertEquals('', $message); + $this->assertSame('', $message); } } \ No newline at end of file diff --git a/tests/Services/ImportExportSystem/EntityExporterTest.php b/tests/Services/ImportExportSystem/EntityExporterTest.php index e9b924b1..8029a2d9 100644 --- a/tests/Services/ImportExportSystem/EntityExporterTest.php +++ b/tests/Services/ImportExportSystem/EntityExporterTest.php @@ -28,7 +28,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\HttpFoundation\Request; use PhpOffice\PhpSpreadsheet\IOFactory; -class EntityExporterTest extends WebTestCase +final class EntityExporterTest extends WebTestCase { /** * @var EntityExporter @@ -111,6 +111,6 @@ class EntityExporterTest extends WebTestCase $response = $this->service->exportEntityFromRequest($entities, $request); $this->assertSame('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $response->headers->get('Content-Type')); - $this->assertStringContainsString('export_Category_simple.xlsx', $response->headers->get('Content-Disposition')); + $this->assertStringContainsString('export_Category_simple.xlsx', (string) $response->headers->get('Content-Disposition')); } } diff --git a/tests/Services/ImportExportSystem/EntityImporterTest.php b/tests/Services/ImportExportSystem/EntityImporterTest.php index 83367f80..b0044dda 100644 --- a/tests/Services/ImportExportSystem/EntityImporterTest.php +++ b/tests/Services/ImportExportSystem/EntityImporterTest.php @@ -41,7 +41,7 @@ use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; #[Group('DB')] -class EntityImporterTest extends WebTestCase +final class EntityImporterTest extends WebTestCase { /** * @var EntityImporter diff --git a/tests/Services/InfoProviderSystem/DTOs/BulkSearchFieldMappingDTOTest.php b/tests/Services/InfoProviderSystem/DTOs/BulkSearchFieldMappingDTOTest.php index e300e2bf..2fd50f9a 100644 --- a/tests/Services/InfoProviderSystem/DTOs/BulkSearchFieldMappingDTOTest.php +++ b/tests/Services/InfoProviderSystem/DTOs/BulkSearchFieldMappingDTOTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Services\InfoProviderSystem\DTOs; +use App\Services\InfoProviderSystem\Providers\InfoProviderInterface; use App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO; use PHPUnit\Framework\TestCase; -class BulkSearchFieldMappingDTOTest extends TestCase +final class BulkSearchFieldMappingDTOTest extends TestCase { public function testProviderInstanceNormalization(): void { - $mockProvider = $this->createMock(\App\Services\InfoProviderSystem\Providers\InfoProviderInterface::class); + $mockProvider = $this->createMock(InfoProviderInterface::class); $mockProvider->method('getProviderKey')->willReturn('mock_provider'); $fieldMapping = new BulkSearchFieldMappingDTO(field: 'mpn', providers: ['provider1', $mockProvider], priority: 5); diff --git a/tests/Services/InfoProviderSystem/DTOs/BulkSearchPartResultsDTOTest.php b/tests/Services/InfoProviderSystem/DTOs/BulkSearchPartResultsDTOTest.php index 09fa4973..d3170d9e 100644 --- a/tests/Services/InfoProviderSystem/DTOs/BulkSearchPartResultsDTOTest.php +++ b/tests/Services/InfoProviderSystem/DTOs/BulkSearchPartResultsDTOTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Services\InfoProviderSystem\DTOs; +use App\Entity\Parts\Part; +use App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultDTO; use App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultsDTO; use PHPUnit\Framework\TestCase; -class BulkSearchPartResultsDTOTest extends TestCase +final class BulkSearchPartResultsDTOTest extends TestCase { public function testHasErrors(): void { - $test = new BulkSearchPartResultsDTO($this->createMock(\App\Entity\Parts\Part::class), [], []); + $test = new BulkSearchPartResultsDTO($this->createStub(Part::class), [], []); $this->assertFalse($test->hasErrors()); - $test = new BulkSearchPartResultsDTO($this->createMock(\App\Entity\Parts\Part::class), [], ['error1']); + $test = new BulkSearchPartResultsDTO($this->createStub(Part::class), [], ['error1']); $this->assertTrue($test->hasErrors()); } public function testGetErrorCount(): void { - $test = new BulkSearchPartResultsDTO($this->createMock(\App\Entity\Parts\Part::class), [], []); + $test = new BulkSearchPartResultsDTO($this->createStub(Part::class), [], []); $this->assertCount(0, $test->errors); - $test = new BulkSearchPartResultsDTO($this->createMock(\App\Entity\Parts\Part::class), [], ['error1', 'error2']); + $test = new BulkSearchPartResultsDTO($this->createStub(Part::class), [], ['error1', 'error2']); $this->assertCount(2, $test->errors); } public function testHasResults(): void { - $test = new BulkSearchPartResultsDTO($this->createMock(\App\Entity\Parts\Part::class), [], []); + $test = new BulkSearchPartResultsDTO($this->createStub(Part::class), [], []); $this->assertFalse($test->hasResults()); - $test = new BulkSearchPartResultsDTO($this->createMock(\App\Entity\Parts\Part::class), [ $this->createMock(\App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultDTO::class) ], []); + $test = new BulkSearchPartResultsDTO($this->createStub(Part::class), [ $this->createStub(BulkSearchPartResultDTO::class) ], []); $this->assertTrue($test->hasResults()); } public function testGetResultCount(): void { - $test = new BulkSearchPartResultsDTO($this->createMock(\App\Entity\Parts\Part::class), [], []); + $test = new BulkSearchPartResultsDTO($this->createStub(Part::class), [], []); $this->assertCount(0, $test->searchResults); - $test = new BulkSearchPartResultsDTO($this->createMock(\App\Entity\Parts\Part::class), [ - $this->createMock(\App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultDTO::class), - $this->createMock(\App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultDTO::class) + $test = new BulkSearchPartResultsDTO($this->createStub(Part::class), [ + $this->createStub(BulkSearchPartResultDTO::class), + $this->createStub(BulkSearchPartResultDTO::class) ], []); $this->assertCount(2, $test->searchResults); } diff --git a/tests/Services/InfoProviderSystem/DTOs/BulkSearchResponseDTOTest.php b/tests/Services/InfoProviderSystem/DTOs/BulkSearchResponseDTOTest.php index ce7564da..f79d8ce8 100644 --- a/tests/Services/InfoProviderSystem/DTOs/BulkSearchResponseDTOTest.php +++ b/tests/Services/InfoProviderSystem/DTOs/BulkSearchResponseDTOTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Services\InfoProviderSystem\DTOs; use App\Entity\Parts\Part; @@ -29,7 +31,7 @@ use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -class BulkSearchResponseDTOTest extends KernelTestCase +final class BulkSearchResponseDTOTest extends KernelTestCase { private EntityManagerInterface $entityManager; diff --git a/tests/Services/InfoProviderSystem/DTOs/FileDTOTest.php b/tests/Services/InfoProviderSystem/DTOs/FileDTOTest.php index 10312aca..fe563fb1 100644 --- a/tests/Services/InfoProviderSystem/DTOs/FileDTOTest.php +++ b/tests/Services/InfoProviderSystem/DTOs/FileDTOTest.php @@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Services\InfoProviderSystem\DTOs\FileDTO; use PHPUnit\Framework\TestCase; -class FileDTOTest extends TestCase +final class FileDTOTest extends TestCase { diff --git a/tests/Services/InfoProviderSystem/DTOs/ParameterDTOTest.php b/tests/Services/InfoProviderSystem/DTOs/ParameterDTOTest.php index 4c4e9bfe..6361dc10 100644 --- a/tests/Services/InfoProviderSystem/DTOs/ParameterDTOTest.php +++ b/tests/Services/InfoProviderSystem/DTOs/ParameterDTOTest.php @@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Services\InfoProviderSystem\DTOs\ParameterDTO; use PHPUnit\Framework\TestCase; -class ParameterDTOTest extends TestCase +final class ParameterDTOTest extends TestCase { public static function parseValueFieldDataProvider(): \Generator diff --git a/tests/Services/InfoProviderSystem/DTOs/PurchaseInfoDTOTest.php b/tests/Services/InfoProviderSystem/DTOs/PurchaseInfoDTOTest.php index 1c909e67..480ff924 100644 --- a/tests/Services/InfoProviderSystem/DTOs/PurchaseInfoDTOTest.php +++ b/tests/Services/InfoProviderSystem/DTOs/PurchaseInfoDTOTest.php @@ -26,7 +26,7 @@ use App\Services\InfoProviderSystem\DTOs\PriceDTO; use App\Services\InfoProviderSystem\DTOs\PurchaseInfoDTO; use PHPUnit\Framework\TestCase; -class PurchaseInfoDTOTest extends TestCase +final class PurchaseInfoDTOTest extends TestCase { public function testThrowOnInvalidType(): void { diff --git a/tests/Services/InfoProviderSystem/DTOs/SearchResultDTOTest.php b/tests/Services/InfoProviderSystem/DTOs/SearchResultDTOTest.php index dd516c8d..4fbac1f3 100644 --- a/tests/Services/InfoProviderSystem/DTOs/SearchResultDTOTest.php +++ b/tests/Services/InfoProviderSystem/DTOs/SearchResultDTOTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Services\InfoProviderSystem\DTOs; use App\Services\InfoProviderSystem\DTOs\SearchResultDTO; use PHPUnit\Framework\TestCase; -class SearchResultDTOTest extends TestCase +final class SearchResultDTOTest extends TestCase { public function testPreviewImageURL(): void { diff --git a/tests/Services/InfoProviderSystem/DTOtoEntityConverterTest.php b/tests/Services/InfoProviderSystem/DTOtoEntityConverterTest.php index 45ea9984..8ea6c71a 100644 --- a/tests/Services/InfoProviderSystem/DTOtoEntityConverterTest.php +++ b/tests/Services/InfoProviderSystem/DTOtoEntityConverterTest.php @@ -35,7 +35,7 @@ use PhpParser\Node\Param; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class DTOtoEntityConverterTest extends WebTestCase +final class DTOtoEntityConverterTest extends WebTestCase { private ?DTOtoEntityConverter $service = null; diff --git a/tests/Services/InfoProviderSystem/ProviderRegistryTest.php b/tests/Services/InfoProviderSystem/ProviderRegistryTest.php index 48a1847f..d3fce441 100644 --- a/tests/Services/InfoProviderSystem/ProviderRegistryTest.php +++ b/tests/Services/InfoProviderSystem/ProviderRegistryTest.php @@ -27,7 +27,7 @@ use App\Services\InfoProviderSystem\Providers\InfoProviderInterface; use App\Services\InfoProviderSystem\Providers\URLHandlerInfoProviderInterface; use PHPUnit\Framework\TestCase; -class ProviderRegistryTest extends TestCase +final class ProviderRegistryTest extends TestCase { /** @var InfoProviderInterface[] */ diff --git a/tests/Services/InfoProviderSystem/Providers/BuerklinProviderTest.php b/tests/Services/InfoProviderSystem/Providers/BuerklinProviderTest.php index 8283b7d3..ef446c9a 100644 --- a/tests/Services/InfoProviderSystem/Providers/BuerklinProviderTest.php +++ b/tests/Services/InfoProviderSystem/Providers/BuerklinProviderTest.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace App\Tests\Services\InfoProviderSystem\Providers; +use PHPUnit\Framework\Attributes\DataProvider; use App\Services\InfoProviderSystem\DTOs\PartDetailDTO; use App\Services\InfoProviderSystem\DTOs\SearchResultDTO; use App\Services\InfoProviderSystem\Providers\BuerklinProvider; @@ -18,7 +19,7 @@ use Symfony\Contracts\HttpClient\ResponseInterface; * Full behavioral test suite for BuerklinProvider. * Includes parameter parsing, compliance parsing, images, prices and batch mode. */ -class BuerklinProviderTest extends TestCase +final class BuerklinProviderTest extends TestCase { private HttpClientInterface $httpClient; private CacheItemPoolInterface $cache; @@ -108,14 +109,14 @@ class BuerklinProviderTest extends TestCase $this->assertSame('Zener voltage', $params[0]->name); $this->assertNull($params[0]->value_text); - $this->assertSame(12.0, $params[0]->value_typ); + $this->assertEqualsWithDelta(12.0, $params[0]->value_typ, PHP_FLOAT_EPSILON); $this->assertNull($params[0]->value_min); $this->assertNull($params[0]->value_max); $this->assertSame('V', $params[0]->unit); $this->assertSame('Length', $params[1]->name); $this->assertNull($params[1]->value_text); - $this->assertSame(2.9, $params[1]->value_typ); + $this->assertEqualsWithDelta(2.9, $params[1]->value_typ, PHP_FLOAT_EPSILON); $this->assertSame('mm', $params[1]->unit); $this->assertSame('Assembly', $params[2]->name); @@ -273,75 +274,70 @@ class BuerklinProviderTest extends TestCase $this->assertSame(['buerklin.com'], $this->provider->getHandledDomains()); } - /** - * @dataProvider buerklinIdFromUrlProvider - */ + #[DataProvider('buerklinIdFromUrlProvider')] public function testGetIDFromURLExtractsId(string $url, ?string $expected): void { $this->assertSame($expected, $this->provider->getIDFromURL($url)); } - public static function buerklinIdFromUrlProvider(): array + public static function buerklinIdFromUrlProvider(): \Iterator { - return [ - 'de long path' => [ - 'https://www.buerklin.com/de/p/bkl-electronic/niedervoltsteckverbinder/072341-l/40F1332/', - '40F1332', - ], - 'de short path' => [ - 'https://www.buerklin.com/de/p/40F1332/', - '40F1332', - ], - 'en long path' => [ - 'https://www.buerklin.com/en/p/bkl-electronic/dc-connectors/072341-l/40F1332/', - '40F1332', - ], - 'en short path' => [ - 'https://www.buerklin.com/en/p/40F1332/', - '40F1332', - ], - 'fragment should be ignored' => [ - 'https://www.buerklin.com/de/p/bkl-electronic/niedervoltsteckverbinder/072341-l/40F1332/#download', - '40F1332', - ], - 'no trailing slash' => [ - 'https://www.buerklin.com/en/p/40F1332', - '40F1332', - ], - 'query should be ignored' => [ - 'https://www.buerklin.com/en/p/40F1332/?foo=bar', - '40F1332', - ], - 'query and fragment should be ignored' => [ - 'https://www.buerklin.com/en/p/40F1332/?foo=bar#download', - '40F1332', - ], - - // Negative cases - 'not a product url (no /p/ segment)' => [ - 'https://www.buerklin.com/de/impressum/', - null, - ], - 'path contains "p" but not "/p/"' => [ - 'https://www.buerklin.com/de/help/price/', - null, - ], - 'ends with /p/ (no id)' => [ - 'https://www.buerklin.com/de/p/', - null, - ], - 'ends with /p (no trailing slash)' => [ - 'https://www.buerklin.com/de/p', - null, - ], - 'empty string' => [ - '', - null, - ], - 'not a url string' => [ - 'not a url', - null, - ], + yield 'de long path' => [ + 'https://www.buerklin.com/de/p/bkl-electronic/niedervoltsteckverbinder/072341-l/40F1332/', + '40F1332', + ]; + yield 'de short path' => [ + 'https://www.buerklin.com/de/p/40F1332/', + '40F1332', + ]; + yield 'en long path' => [ + 'https://www.buerklin.com/en/p/bkl-electronic/dc-connectors/072341-l/40F1332/', + '40F1332', + ]; + yield 'en short path' => [ + 'https://www.buerklin.com/en/p/40F1332/', + '40F1332', + ]; + yield 'fragment should be ignored' => [ + 'https://www.buerklin.com/de/p/bkl-electronic/niedervoltsteckverbinder/072341-l/40F1332/#download', + '40F1332', + ]; + yield 'no trailing slash' => [ + 'https://www.buerklin.com/en/p/40F1332', + '40F1332', + ]; + yield 'query should be ignored' => [ + 'https://www.buerklin.com/en/p/40F1332/?foo=bar', + '40F1332', + ]; + yield 'query and fragment should be ignored' => [ + 'https://www.buerklin.com/en/p/40F1332/?foo=bar#download', + '40F1332', + ]; + // Negative cases + yield 'not a product url (no /p/ segment)' => [ + 'https://www.buerklin.com/de/impressum/', + null, + ]; + yield 'path contains "p" but not "/p/"' => [ + 'https://www.buerklin.com/de/help/price/', + null, + ]; + yield 'ends with /p/ (no id)' => [ + 'https://www.buerklin.com/de/p/', + null, + ]; + yield 'ends with /p (no trailing slash)' => [ + 'https://www.buerklin.com/de/p', + null, + ]; + yield 'empty string' => [ + '', + null, + ]; + yield 'not a url string' => [ + 'not a url', + null, ]; } } diff --git a/tests/Services/InfoProviderSystem/Providers/LCSCProviderTest.php b/tests/Services/InfoProviderSystem/Providers/LCSCProviderTest.php index 57527f57..dc19de6b 100644 --- a/tests/Services/InfoProviderSystem/Providers/LCSCProviderTest.php +++ b/tests/Services/InfoProviderSystem/Providers/LCSCProviderTest.php @@ -37,7 +37,7 @@ use Symfony\Component\HttpClient\MockHttpClient; use Symfony\Component\HttpClient\Response\MockResponse; use Symfony\Contracts\HttpClient\HttpClientInterface; -class LCSCProviderTest extends TestCase +final class LCSCProviderTest extends TestCase { private LCSCSettings $settings; private LCSCProvider $provider; @@ -67,7 +67,7 @@ class LCSCProviderTest extends TestCase public function testGetProviderKey(): void { - $this->assertEquals('lcsc', $this->provider->getProviderKey()); + $this->assertSame('lcsc', $this->provider->getProviderKey()); } public function testIsActiveWhenEnabled(): void @@ -125,8 +125,8 @@ class LCSCProviderTest extends TestCase $this->assertIsArray($results); $this->assertCount(1, $results); $this->assertInstanceOf(PartDetailDTO::class, $results[0]); - $this->assertEquals('C123456', $results[0]->provider_id); - $this->assertEquals('Test Component', $results[0]->name); + $this->assertSame('C123456', $results[0]->provider_id); + $this->assertSame('Test Component', $results[0]->name); } public function testSearchByKeywordWithRegularTerm(): void @@ -162,8 +162,8 @@ class LCSCProviderTest extends TestCase $this->assertIsArray($results); $this->assertCount(1, $results); $this->assertInstanceOf(PartDetailDTO::class, $results[0]); - $this->assertEquals('C789012', $results[0]->provider_id); - $this->assertEquals('Regular Component', $results[0]->name); + $this->assertSame('C789012', $results[0]->provider_id); + $this->assertSame('Regular Component', $results[0]->name); } public function testSearchByKeywordWithTipProduct(): void @@ -202,8 +202,8 @@ class LCSCProviderTest extends TestCase $this->assertIsArray($results); $this->assertCount(1, $results); $this->assertInstanceOf(PartDetailDTO::class, $results[0]); - $this->assertEquals('C555555', $results[0]->provider_id); - $this->assertEquals('Tip Component', $results[0]->name); + $this->assertSame('C555555', $results[0]->provider_id); + $this->assertSame('Tip Component', $results[0]->name); } public function testSearchByKeywordsBatch(): void @@ -288,12 +288,12 @@ class LCSCProviderTest extends TestCase $result = $this->provider->getDetails('C123456'); $this->assertInstanceOf(PartDetailDTO::class, $result); - $this->assertEquals('C123456', $result->provider_id); - $this->assertEquals('Detailed Component', $result->name); - $this->assertEquals('Detailed description', $result->description); - $this->assertEquals('Detailed Manufacturer', $result->manufacturer); + $this->assertSame('C123456', $result->provider_id); + $this->assertSame('Detailed Component', $result->name); + $this->assertSame('Detailed description', $result->description); + $this->assertSame('Detailed Manufacturer', $result->manufacturer); $this->assertEquals('0603', $result->footprint); - $this->assertEquals('https://www.lcsc.com/product-detail/C123456.html', $result->provider_url); + $this->assertSame('https://www.lcsc.com/product-detail/C123456.html', $result->provider_url); $this->assertCount(1, $result->images); $this->assertCount(2, $result->parameters); $this->assertCount(1, $result->vendor_infos); @@ -465,8 +465,8 @@ class LCSCProviderTest extends TestCase $this->assertIsArray($result); $this->assertCount(1, $result); $this->assertInstanceOf(PurchaseInfoDTO::class, $result[0]); - $this->assertEquals('LCSC', $result[0]->distributor_name); - $this->assertEquals('C123456', $result[0]->order_number); + $this->assertSame('LCSC', $result[0]->distributor_name); + $this->assertSame('C123456', $result[0]->order_number); $this->assertCount(2, $result[0]->prices); } @@ -493,7 +493,7 @@ class LCSCProviderTest extends TestCase $this->httpClient->setResponseFactory([$mockResponse]); $result = $this->provider->getDetails('C123456'); - $this->assertEquals('Electronic Components -> Resistors (SMT)', $result->category); + $this->assertSame('Electronic Components -> Resistors (SMT)', $result->category); } public function testEmptyFootprintHandling(): void diff --git a/tests/Services/LabelSystem/BarcodeScanner/BarcodeScanHelperTest.php b/tests/Services/LabelSystem/BarcodeScanner/BarcodeScanHelperTest.php index fcea7730..248f1ae9 100644 --- a/tests/Services/LabelSystem/BarcodeScanner/BarcodeScanHelperTest.php +++ b/tests/Services/LabelSystem/BarcodeScanner/BarcodeScanHelperTest.php @@ -50,7 +50,7 @@ use App\Services\LabelSystem\BarcodeScanner\EIGP114BarcodeScanResult; use App\Services\LabelSystem\BarcodeScanner\LocalBarcodeScanResult; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class BarcodeScanHelperTest extends WebTestCase +final class BarcodeScanHelperTest extends WebTestCase { private ?BarcodeScanHelper $service = null; diff --git a/tests/Services/LabelSystem/BarcodeScanner/EIGP114BarcodeScanResultTest.php b/tests/Services/LabelSystem/BarcodeScanner/EIGP114BarcodeScanResultTest.php index 3a414997..6d69a773 100644 --- a/tests/Services/LabelSystem/BarcodeScanner/EIGP114BarcodeScanResultTest.php +++ b/tests/Services/LabelSystem/BarcodeScanner/EIGP114BarcodeScanResultTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Services\LabelSystem\BarcodeScanner; use App\Services\LabelSystem\BarcodeScanner\EIGP114BarcodeScanResult; use PHPUnit\Framework\TestCase; -class EIGP114BarcodeScanResultTest extends TestCase +final class EIGP114BarcodeScanResultTest extends TestCase { public function testGuessBarcodeVendor(): void diff --git a/tests/Services/LabelSystem/Barcodes/BarcodeContentGeneratorTest.php b/tests/Services/LabelSystem/Barcodes/BarcodeContentGeneratorTest.php index 69458734..d9185735 100644 --- a/tests/Services/LabelSystem/Barcodes/BarcodeContentGeneratorTest.php +++ b/tests/Services/LabelSystem/Barcodes/BarcodeContentGeneratorTest.php @@ -48,7 +48,7 @@ use App\Entity\Parts\StorageLocation; use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -class BarcodeContentGeneratorTest extends KernelTestCase +final class BarcodeContentGeneratorTest extends KernelTestCase { private ?object $service = null; diff --git a/tests/Services/LabelSystem/Barcodes/BarcodeHelperTest.php b/tests/Services/LabelSystem/Barcodes/BarcodeHelperTest.php index d681b3b9..e03221e5 100644 --- a/tests/Services/LabelSystem/Barcodes/BarcodeHelperTest.php +++ b/tests/Services/LabelSystem/Barcodes/BarcodeHelperTest.php @@ -27,7 +27,7 @@ use App\Services\LabelSystem\Barcodes\BarcodeHelper; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class BarcodeHelperTest extends WebTestCase +final class BarcodeHelperTest extends WebTestCase { protected ?BarcodeHelper $service = null; diff --git a/tests/Services/LabelSystem/LabelGeneratorTest.php b/tests/Services/LabelSystem/LabelGeneratorTest.php index 916d4317..5f6d8f04 100644 --- a/tests/Services/LabelSystem/LabelGeneratorTest.php +++ b/tests/Services/LabelSystem/LabelGeneratorTest.php @@ -51,7 +51,7 @@ use App\Entity\Parts\StorageLocation; use App\Services\LabelSystem\LabelGenerator; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class LabelGeneratorTest extends WebTestCase +final class LabelGeneratorTest extends WebTestCase { /** * @var LabelGenerator diff --git a/tests/Services/LabelSystem/LabelTextReplacerTest.php b/tests/Services/LabelSystem/LabelTextReplacerTest.php index 346d1bab..c4a140d8 100644 --- a/tests/Services/LabelSystem/LabelTextReplacerTest.php +++ b/tests/Services/LabelSystem/LabelTextReplacerTest.php @@ -47,7 +47,7 @@ use App\Entity\Parts\PartLot; use App\Services\LabelSystem\LabelTextReplacer; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class LabelTextReplacerTest extends WebTestCase +final class LabelTextReplacerTest extends WebTestCase { /** * @var LabelTextReplacer diff --git a/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php index fb917b82..584f708a 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/AbstractElementProviderTest.php @@ -46,7 +46,7 @@ use App\Entity\Base\AbstractDBElement; use App\Services\LabelSystem\PlaceholderProviders\AbstractDBElementProvider; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class AbstractElementProviderTest extends WebTestCase +final class AbstractElementProviderTest extends WebTestCase { /** * @var AbstractDBElementProvider diff --git a/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php b/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php index d74bb215..80b6b76f 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/GlobalProvidersTest.php @@ -46,7 +46,7 @@ use App\Entity\Parts\Part; use App\Services\LabelSystem\PlaceholderProviders\GlobalProviders; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class GlobalProvidersTest extends WebTestCase +final class GlobalProvidersTest extends WebTestCase { /** * @var GlobalProviders diff --git a/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php index c5efc768..88b77e8e 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/NamedElementProviderTest.php @@ -46,7 +46,7 @@ use App\Entity\Contracts\NamedElementInterface; use App\Services\LabelSystem\PlaceholderProviders\NamedElementProvider; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class NamedElementProviderTest extends WebTestCase +final class NamedElementProviderTest extends WebTestCase { /** * @var NamedElementProvider diff --git a/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php index 5aa8f1bd..68425250 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/PartLotProviderTest.php @@ -49,7 +49,7 @@ use App\Entity\UserSystem\User; use App\Services\LabelSystem\PlaceholderProviders\PartLotProvider; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class PartLotProviderTest extends WebTestCase +final class PartLotProviderTest extends WebTestCase { /** * @var PartLotProvider diff --git a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php index 7af936cd..9f1c74f7 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/PartProviderTest.php @@ -53,7 +53,7 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; #[Group('DB')] -class PartProviderTest extends WebTestCase +final class PartProviderTest extends WebTestCase { /** * @var PartProvider @@ -62,20 +62,15 @@ class PartProviderTest extends WebTestCase protected Part $target; - /** - * @var EntityManager - */ - protected $em; - protected function setUp(): void { self::bootKernel(); $this->service = self::getContainer()->get(PartProvider::class); $this->target = new Part(); - $this->em = self::getContainer()->get(EntityManagerInterface::class); + $em = self::getContainer()->get(EntityManagerInterface::class); - $this->target->setCategory($this->em->find(Category::class, 6)); - $this->target->setFootprint($this->em->find(Footprint::class, 6)); + $this->target->setCategory($em->find(Category::class, 6)); + $this->target->setFootprint($em->find(Footprint::class, 6)); $this->target->setManufacturer(null); $this->target->setMass(1234.2); diff --git a/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php b/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php index 6aa152b9..b5415131 100644 --- a/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php +++ b/tests/Services/LabelSystem/PlaceholderProviders/TimestampableElementProviderTest.php @@ -48,7 +48,7 @@ use App\Services\LabelSystem\PlaceholderProviders\TimestampableElementProvider; use DateTime; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class TimestampableElementProviderTest extends WebTestCase +final class TimestampableElementProviderTest extends WebTestCase { /** * @var GlobalProviders diff --git a/tests/Services/LabelSystem/SandboxedTwigFactoryTest.php b/tests/Services/LabelSystem/SandboxedTwigFactoryTest.php index 32317435..f10ef333 100644 --- a/tests/Services/LabelSystem/SandboxedTwigFactoryTest.php +++ b/tests/Services/LabelSystem/SandboxedTwigFactoryTest.php @@ -52,7 +52,7 @@ use App\Services\LabelSystem\SandboxedTwigFactory; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Twig\Sandbox\SecurityError; -class SandboxedTwigFactoryTest extends WebTestCase +final class SandboxedTwigFactoryTest extends WebTestCase { private ?SandboxedTwigFactory $service = null; diff --git a/tests/Services/LogSystem/EventCommentHelperTest.php b/tests/Services/LogSystem/EventCommentHelperTest.php index 9c78d4c6..616c1ddf 100644 --- a/tests/Services/LogSystem/EventCommentHelperTest.php +++ b/tests/Services/LogSystem/EventCommentHelperTest.php @@ -44,7 +44,7 @@ namespace App\Tests\Services\LogSystem; use App\Services\LogSystem\EventCommentHelper; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class EventCommentHelperTest extends WebTestCase +final class EventCommentHelperTest extends WebTestCase { /** * @var EventCommentHelper diff --git a/tests/Services/LogSystem/EventCommentNeededHelperTest.php b/tests/Services/LogSystem/EventCommentNeededHelperTest.php index 2eb2aceb..3ef238c5 100644 --- a/tests/Services/LogSystem/EventCommentNeededHelperTest.php +++ b/tests/Services/LogSystem/EventCommentNeededHelperTest.php @@ -28,7 +28,7 @@ use App\Settings\SystemSettings\HistorySettings; use App\Tests\SettingsTestHelper; use PHPUnit\Framework\TestCase; -class EventCommentNeededHelperTest extends TestCase +final class EventCommentNeededHelperTest extends TestCase { public function testIsCommentNeeded(): void { diff --git a/tests/Services/LogSystem/EventLoggerTest.php b/tests/Services/LogSystem/EventLoggerTest.php index 0dbb85a3..69870ac8 100644 --- a/tests/Services/LogSystem/EventLoggerTest.php +++ b/tests/Services/LogSystem/EventLoggerTest.php @@ -48,7 +48,7 @@ use App\Entity\LogSystem\UserLogoutLogEntry; use App\Services\LogSystem\EventLogger; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class EventLoggerTest extends WebTestCase +final class EventLoggerTest extends WebTestCase { /** * @var EventLogger diff --git a/tests/Services/LogSystem/TimeTravelTest.php b/tests/Services/LogSystem/TimeTravelTest.php index f0068778..9b51592d 100644 --- a/tests/Services/LogSystem/TimeTravelTest.php +++ b/tests/Services/LogSystem/TimeTravelTest.php @@ -29,7 +29,7 @@ use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -class TimeTravelTest extends KernelTestCase +final class TimeTravelTest extends KernelTestCase { private TimeTravel $service; diff --git a/tests/Services/Misc/FAIconGeneratorTest.php b/tests/Services/Misc/FAIconGeneratorTest.php index 1aec5d02..445c167c 100644 --- a/tests/Services/Misc/FAIconGeneratorTest.php +++ b/tests/Services/Misc/FAIconGeneratorTest.php @@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Services\Misc\FAIconGenerator; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class FAIconGeneratorTest extends WebTestCase +final class FAIconGeneratorTest extends WebTestCase { /** * @var FAIconGenerator diff --git a/tests/Services/Misc/MySQLDumpXMLConverterTest.php b/tests/Services/Misc/MySQLDumpXMLConverterTest.php index 98614b4b..a56083d8 100644 --- a/tests/Services/Misc/MySQLDumpXMLConverterTest.php +++ b/tests/Services/Misc/MySQLDumpXMLConverterTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Services\Misc; use App\Services\ImportExportSystem\PartKeeprImporter\MySQLDumpXMLConverter; use PHPUnit\Framework\TestCase; -class MySQLDumpXMLConverterTest extends TestCase +final class MySQLDumpXMLConverterTest extends TestCase { public function testConvertMySQLDumpXMLDataToArrayStructure(): void diff --git a/tests/Services/Misc/RangeParserTest.php b/tests/Services/Misc/RangeParserTest.php index 084ca80b..894034be 100644 --- a/tests/Services/Misc/RangeParserTest.php +++ b/tests/Services/Misc/RangeParserTest.php @@ -45,7 +45,7 @@ use PHPUnit\Framework\Attributes\DataProvider; use App\Services\Misc\RangeParser; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class RangeParserTest extends WebTestCase +final class RangeParserTest extends WebTestCase { /** * @var RangeParser diff --git a/tests/Services/Parameters/ParameterExtractorTest.php b/tests/Services/Parameters/ParameterExtractorTest.php index d0b8fed0..353a0697 100644 --- a/tests/Services/Parameters/ParameterExtractorTest.php +++ b/tests/Services/Parameters/ParameterExtractorTest.php @@ -46,7 +46,7 @@ use App\Entity\Parameters\AbstractParameter; use App\Services\Parameters\ParameterExtractor; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class ParameterExtractorTest extends WebTestCase +final class ParameterExtractorTest extends WebTestCase { protected $service; diff --git a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php index b033f07e..de684094 100644 --- a/tests/Services/Parts/PartLotWithdrawAddHelperTest.php +++ b/tests/Services/Parts/PartLotWithdrawAddHelperTest.php @@ -18,7 +18,7 @@ class TestPartLot extends PartLot } } -class PartLotWithdrawAddHelperTest extends WebTestCase +final class PartLotWithdrawAddHelperTest extends WebTestCase { /** diff --git a/tests/Services/Parts/PartsTableActionHandlerTest.php b/tests/Services/Parts/PartsTableActionHandlerTest.php index c5105cd7..1772195e 100644 --- a/tests/Services/Parts/PartsTableActionHandlerTest.php +++ b/tests/Services/Parts/PartsTableActionHandlerTest.php @@ -27,7 +27,7 @@ use App\Services\Parts\PartsTableActionHandler; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\HttpFoundation\RedirectResponse; -class PartsTableActionHandlerTest extends WebTestCase +final class PartsTableActionHandlerTest extends WebTestCase { private PartsTableActionHandler $service; diff --git a/tests/Services/Parts/PricedetailHelperTest.php b/tests/Services/Parts/PricedetailHelperTest.php index 5d9bd351..08a5d6dd 100644 --- a/tests/Services/Parts/PricedetailHelperTest.php +++ b/tests/Services/Parts/PricedetailHelperTest.php @@ -30,7 +30,7 @@ use App\Services\Formatters\AmountFormatter; use App\Services\Parts\PricedetailHelper; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class PricedetailHelperTest extends WebTestCase +final class PricedetailHelperTest extends WebTestCase { /** * @var AmountFormatter diff --git a/tests/Services/ProjectSystem/ProjectBuildHelperTest.php b/tests/Services/ProjectSystem/ProjectBuildHelperTest.php index 5009f849..fb31b51e 100644 --- a/tests/Services/ProjectSystem/ProjectBuildHelperTest.php +++ b/tests/Services/ProjectSystem/ProjectBuildHelperTest.php @@ -29,7 +29,7 @@ use App\Entity\ProjectSystem\ProjectBOMEntry; use App\Services\ProjectSystem\ProjectBuildHelper; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class ProjectBuildHelperTest extends WebTestCase +final class ProjectBuildHelperTest extends WebTestCase { /** @var ProjectBuildHelper */ protected $service; diff --git a/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php b/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php index 4baa7cf3..894f6315 100644 --- a/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php +++ b/tests/Services/ProjectSystem/ProjectBuildPartHelperTest.php @@ -26,7 +26,7 @@ use App\Entity\ProjectSystem\Project; use App\Services\ProjectSystem\ProjectBuildPartHelper; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class ProjectBuildPartHelperTest extends WebTestCase +final class ProjectBuildPartHelperTest extends WebTestCase { /** @var ProjectBuildPartHelper */ protected $service; diff --git a/tests/Services/System/BackupManagerTest.php b/tests/Services/System/BackupManagerTest.php index 145b039d..f75ef8f3 100644 --- a/tests/Services/System/BackupManagerTest.php +++ b/tests/Services/System/BackupManagerTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Services\System; use App\Services\System\BackupManager; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -class BackupManagerTest extends KernelTestCase +final class BackupManagerTest extends KernelTestCase { private ?BackupManager $backupManager = null; @@ -77,9 +77,9 @@ class BackupManagerTest extends KernelTestCase $result = preg_match('/pre-update-v([\d.]+)-to-v?([\d.]+)-/', $filename, $matches); - $this->assertEquals(1, $result); - $this->assertEquals('2.5.1', $matches[1]); - $this->assertEquals('2.6.0', $matches[2]); + $this->assertSame(1, $result); + $this->assertSame('2.5.1', $matches[1]); + $this->assertSame('2.6.0', $matches[2]); } /** @@ -90,13 +90,13 @@ class BackupManagerTest extends KernelTestCase // Without 'v' prefix on target version $filename1 = 'pre-update-v1.0.0-to-2.0.0-2024-01-30-185400.zip'; preg_match('/pre-update-v([\d.]+)-to-v?([\d.]+)-/', $filename1, $matches1); - $this->assertEquals('1.0.0', $matches1[1]); - $this->assertEquals('2.0.0', $matches1[2]); + $this->assertSame('1.0.0', $matches1[1]); + $this->assertSame('2.0.0', $matches1[2]); // With 'v' prefix on target version $filename2 = 'pre-update-v1.0.0-to-v2.0.0-2024-01-30-185400.zip'; preg_match('/pre-update-v([\d.]+)-to-v?([\d.]+)-/', $filename2, $matches2); - $this->assertEquals('1.0.0', $matches2[1]); - $this->assertEquals('2.0.0', $matches2[2]); + $this->assertSame('1.0.0', $matches2[1]); + $this->assertSame('2.0.0', $matches2[2]); } } diff --git a/tests/Services/System/UpdateExecutorTest.php b/tests/Services/System/UpdateExecutorTest.php index 851d060c..48cddf8d 100644 --- a/tests/Services/System/UpdateExecutorTest.php +++ b/tests/Services/System/UpdateExecutorTest.php @@ -25,7 +25,7 @@ namespace App\Tests\Services\System; use App\Services\System\UpdateExecutor; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -class UpdateExecutorTest extends KernelTestCase +final class UpdateExecutorTest extends KernelTestCase { private ?UpdateExecutor $updateExecutor = null; diff --git a/tests/Services/Trees/NodesListBuilderTest.php b/tests/Services/Trees/NodesListBuilderTest.php index 8f4bf23b..d314114d 100644 --- a/tests/Services/Trees/NodesListBuilderTest.php +++ b/tests/Services/Trees/NodesListBuilderTest.php @@ -30,7 +30,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; /** * @Group DB */ -class NodesListBuilderTest extends WebTestCase +final class NodesListBuilderTest extends WebTestCase { protected $em; /** diff --git a/tests/Services/Trees/TreeViewGeneratorTest.php b/tests/Services/Trees/TreeViewGeneratorTest.php index ebec94d6..190f1068 100644 --- a/tests/Services/Trees/TreeViewGeneratorTest.php +++ b/tests/Services/Trees/TreeViewGeneratorTest.php @@ -31,7 +31,7 @@ use Doctrine\ORM\EntityManagerInterface; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; #[Group('DB')] -class TreeViewGeneratorTest extends WebTestCase +final class TreeViewGeneratorTest extends WebTestCase { protected $em; /** diff --git a/tests/Services/UserSystem/PermissionManagerTest.php b/tests/Services/UserSystem/PermissionManagerTest.php index 478202f4..e6da72d4 100644 --- a/tests/Services/UserSystem/PermissionManagerTest.php +++ b/tests/Services/UserSystem/PermissionManagerTest.php @@ -30,7 +30,7 @@ use App\Services\UserSystem\PermissionManager; use InvalidArgumentException; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class PermissionManagerTest extends WebTestCase +final class PermissionManagerTest extends WebTestCase { protected ?User $user_withoutGroup = null; diff --git a/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php b/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php index 1e41474c..738ff649 100644 --- a/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php +++ b/tests/Services/UserSystem/PermissionSchemaUpdaterTest.php @@ -39,7 +39,7 @@ class TestPermissionHolder implements HasPermissionsInterface } } -class PermissionSchemaUpdaterTest extends WebTestCase +final class PermissionSchemaUpdaterTest extends WebTestCase { /** * @var PermissionSchemaUpdater diff --git a/tests/Services/UserSystem/TFA/BackupCodeGeneratorTest.php b/tests/Services/UserSystem/TFA/BackupCodeGeneratorTest.php index 2b6c22d1..5a54f2f3 100644 --- a/tests/Services/UserSystem/TFA/BackupCodeGeneratorTest.php +++ b/tests/Services/UserSystem/TFA/BackupCodeGeneratorTest.php @@ -27,7 +27,7 @@ use App\Services\UserSystem\TFA\BackupCodeGenerator; use PHPUnit\Framework\TestCase; use RuntimeException; -class BackupCodeGeneratorTest extends TestCase +final class BackupCodeGeneratorTest extends TestCase { /** * Test if an exception is thrown if you are using a too high code length. diff --git a/tests/Services/UserSystem/TFA/BackupCodeManagerTest.php b/tests/Services/UserSystem/TFA/BackupCodeManagerTest.php index 35b7f4f8..4b1a0496 100644 --- a/tests/Services/UserSystem/TFA/BackupCodeManagerTest.php +++ b/tests/Services/UserSystem/TFA/BackupCodeManagerTest.php @@ -26,7 +26,7 @@ use App\Entity\UserSystem\User; use App\Services\UserSystem\TFA\BackupCodeManager; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class BackupCodeManagerTest extends WebTestCase +final class BackupCodeManagerTest extends WebTestCase { /** * @var BackupCodeManager diff --git a/tests/Services/UserSystem/VoterHelperTest.php b/tests/Services/UserSystem/VoterHelperTest.php index 53d7ee82..3f21c9ab 100644 --- a/tests/Services/UserSystem/VoterHelperTest.php +++ b/tests/Services/UserSystem/VoterHelperTest.php @@ -34,7 +34,7 @@ use Symfony\Component\Security\Core\Authentication\Token\NullToken; use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; use Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken; -class VoterHelperTest extends KernelTestCase +final class VoterHelperTest extends KernelTestCase { protected ?VoterHelper $service = null; diff --git a/tests/Settings/SynonymSettingsTest.php b/tests/Settings/SynonymSettingsTest.php index 2d1407ac..00e5be4c 100644 --- a/tests/Settings/SynonymSettingsTest.php +++ b/tests/Settings/SynonymSettingsTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Settings; use App\Services\ElementTypes; @@ -25,7 +27,7 @@ use App\Settings\SynonymSettings; use App\Tests\SettingsTestHelper; use PHPUnit\Framework\TestCase; -class SynonymSettingsTest extends TestCase +final class SynonymSettingsTest extends TestCase { public function testGetSingularSynonymForType(): void diff --git a/tests/Twig/EntityExtensionTest.php b/tests/Twig/EntityExtensionTest.php index 18fe970b..f3d5bef9 100644 --- a/tests/Twig/EntityExtensionTest.php +++ b/tests/Twig/EntityExtensionTest.php @@ -39,7 +39,7 @@ use App\Entity\UserSystem\User; use App\Twig\EntityExtension; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class EntityExtensionTest extends WebTestCase +final class EntityExtensionTest extends WebTestCase { /** @var EntityExtension */ protected $service; diff --git a/tests/Twig/TwigCoreExtensionTest.php b/tests/Twig/TwigCoreExtensionTest.php index 1aa1f7ca..be8ced04 100644 --- a/tests/Twig/TwigCoreExtensionTest.php +++ b/tests/Twig/TwigCoreExtensionTest.php @@ -26,7 +26,7 @@ use App\Twig\TwigCoreExtension; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class TwigCoreExtensionTest extends WebTestCase +final class TwigCoreExtensionTest extends WebTestCase { /** @var TwigCoreExtension */ protected $service; diff --git a/tests/Twig/UserExtensionTest.php b/tests/Twig/UserExtensionTest.php index 235d39c1..f8422a2c 100644 --- a/tests/Twig/UserExtensionTest.php +++ b/tests/Twig/UserExtensionTest.php @@ -27,7 +27,7 @@ use App\Twig\UserExtension; use PHPUnit\Framework\TestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -class UserExtensionTest extends WebTestCase +final class UserExtensionTest extends WebTestCase { protected $service; diff --git a/tests/Validator/Constraints/NoneOfItsChildrenValidatorTest.php b/tests/Validator/Constraints/NoneOfItsChildrenValidatorTest.php index 0efcd5de..e4b721ca 100644 --- a/tests/Validator/Constraints/NoneOfItsChildrenValidatorTest.php +++ b/tests/Validator/Constraints/NoneOfItsChildrenValidatorTest.php @@ -28,15 +28,12 @@ use App\Validator\Constraints\NoneOfItsChildren; use App\Validator\Constraints\NoneOfItsChildrenValidator; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; -class NoneOfItsChildrenValidatorTest extends ConstraintValidatorTestCase +final class NoneOfItsChildrenValidatorTest extends ConstraintValidatorTestCase { protected AttachmentType $root_node; protected AttachmentType $child1; - protected AttachmentType $child2; - protected AttachmentType $child3; protected AttachmentType $child1_1; - protected AttachmentType $child1_2; protected function setUp(): void { @@ -49,14 +46,14 @@ class NoneOfItsChildrenValidatorTest extends ConstraintValidatorTestCase $this->root_node->setName('root')->setParent(null); $this->child1 = new AttachmentType(); $this->child1->setParent($this->root_node)->setName('child1'); - $this->child2 = new AttachmentType(); - $this->child2->setName('child2')->setParent($this->root_node); - $this->child3 = new AttachmentType(); - $this->child3->setName('child3')->setParent($this->root_node); + $child2 = new AttachmentType(); + $child2->setName('child2')->setParent($this->root_node); + $child3 = new AttachmentType(); + $child3->setName('child3')->setParent($this->root_node); $this->child1_1 = new AttachmentType(); $this->child1_1->setName('child1_1')->setParent($this->child1); - $this->child1_2 = new AttachmentType(); - $this->child1_2->setName('child1_2')->setParent($this->child1); + $child1_2 = new AttachmentType(); + $child1_2->setName('child1_2')->setParent($this->child1); } diff --git a/tests/Validator/Constraints/SelectableValidatorTest.php b/tests/Validator/Constraints/SelectableValidatorTest.php index bc520621..68f36f87 100644 --- a/tests/Validator/Constraints/SelectableValidatorTest.php +++ b/tests/Validator/Constraints/SelectableValidatorTest.php @@ -29,7 +29,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; -class SelectableValidatorTest extends ConstraintValidatorTestCase +final class SelectableValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): SelectableValidator { diff --git a/tests/Validator/Constraints/UniqueObjectCollectionValidatorTest.php b/tests/Validator/Constraints/UniqueObjectCollectionValidatorTest.php index d9fab6cf..3863d604 100644 --- a/tests/Validator/Constraints/UniqueObjectCollectionValidatorTest.php +++ b/tests/Validator/Constraints/UniqueObjectCollectionValidatorTest.php @@ -30,7 +30,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Exception\UnexpectedValueException; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; -class UniqueObjectCollectionValidatorTest extends ConstraintValidatorTestCase +final class UniqueObjectCollectionValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): UniqueObjectCollectionValidator { diff --git a/tests/Validator/Constraints/UrlOrBuiltinValidatorTest.php b/tests/Validator/Constraints/UrlOrBuiltinValidatorTest.php index c75754df..326809df 100644 --- a/tests/Validator/Constraints/UrlOrBuiltinValidatorTest.php +++ b/tests/Validator/Constraints/UrlOrBuiltinValidatorTest.php @@ -27,7 +27,7 @@ use App\Validator\Constraints\UrlOrBuiltinValidator; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; -class UrlOrBuiltinValidatorTest extends ConstraintValidatorTestCase +final class UrlOrBuiltinValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): UrlOrBuiltinValidator diff --git a/tests/Validator/Constraints/ValidGTINValidatorTest.php b/tests/Validator/Constraints/ValidGTINValidatorTest.php index f35b053a..6b01519b 100644 --- a/tests/Validator/Constraints/ValidGTINValidatorTest.php +++ b/tests/Validator/Constraints/ValidGTINValidatorTest.php @@ -1,4 +1,7 @@ . */ - namespace App\Tests\Validator\Constraints; +use App\Validator\Constraints\ValidGTIN; use App\Validator\Constraints\ValidGTINValidator; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\ConstraintValidatorInterface; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; -class ValidGTINValidatorTest extends ConstraintValidatorTestCase +final class ValidGTINValidatorTest extends ConstraintValidatorTestCase { public function testAllowNull(): void { - $this->validator->validate(null, new \App\Validator\Constraints\ValidGTIN()); + $this->validator->validate(null, new ValidGTIN()); $this->assertNoViolation(); } public function testValidGTIN8(): void { - $this->validator->validate('12345670', new \App\Validator\Constraints\ValidGTIN()); + $this->validator->validate('12345670', new ValidGTIN()); $this->assertNoViolation(); } public function testValidGTIN12(): void { - $this->validator->validate('123456789012', new \App\Validator\Constraints\ValidGTIN()); + $this->validator->validate('123456789012', new ValidGTIN()); $this->assertNoViolation(); } public function testValidGTIN13(): void { - $this->validator->validate('1234567890128', new \App\Validator\Constraints\ValidGTIN()); + $this->validator->validate('1234567890128', new ValidGTIN()); $this->assertNoViolation(); } public function testValidGTIN14(): void { - $this->validator->validate('12345678901231', new \App\Validator\Constraints\ValidGTIN()); + $this->validator->validate('12345678901231', new ValidGTIN()); $this->assertNoViolation(); } public function testInvalidGTIN(): void { - $this->validator->validate('1234567890123', new \App\Validator\Constraints\ValidGTIN()); + $this->validator->validate('1234567890123', new ValidGTIN()); $this->buildViolation('validator.invalid_gtin') ->assertRaised(); } diff --git a/tests/Validator/Constraints/ValidGoogleAuthCodeValidatorTest.php b/tests/Validator/Constraints/ValidGoogleAuthCodeValidatorTest.php index 6eb9270e..4924f34b 100644 --- a/tests/Validator/Constraints/ValidGoogleAuthCodeValidatorTest.php +++ b/tests/Validator/Constraints/ValidGoogleAuthCodeValidatorTest.php @@ -34,7 +34,7 @@ use Symfony\Component\Validator\ConstraintValidator; use Symfony\Component\Validator\ConstraintValidatorInterface; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; -class ValidGoogleAuthCodeValidatorTest extends ConstraintValidatorTestCase +final class ValidGoogleAuthCodeValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): ConstraintValidatorInterface diff --git a/tests/Validator/Constraints/ValidThemeValidatorTest.php b/tests/Validator/Constraints/ValidThemeValidatorTest.php index 9db8f33b..50b11820 100644 --- a/tests/Validator/Constraints/ValidThemeValidatorTest.php +++ b/tests/Validator/Constraints/ValidThemeValidatorTest.php @@ -27,7 +27,7 @@ use App\Validator\Constraints\ValidThemeValidator; use PHPUnit\Framework\TestCase; use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; -class ValidThemeValidatorTest extends ConstraintValidatorTestCase +final class ValidThemeValidatorTest extends ConstraintValidatorTestCase { protected function createValidator(): ValidThemeValidator