mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2026-02-16 06:29:36 +00:00
Ran rector and made tests final
This commit is contained in:
parent
43d72faf48
commit
b21d294cf8
162 changed files with 407 additions and 393 deletions
|
|
@ -28,7 +28,7 @@ use App\Entity\UserSystem\User;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class APIDocsAvailabilityTest extends WebTestCase
|
final class APIDocsAvailabilityTest extends WebTestCase
|
||||||
{
|
{
|
||||||
#[DataProvider('urlProvider')]
|
#[DataProvider('urlProvider')]
|
||||||
public function testDocAvailabilityForLoggedInUser(string $url): void
|
public function testDocAvailabilityForLoggedInUser(string $url): void
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
|
||||||
use App\DataFixtures\APITokenFixtures;
|
use App\DataFixtures\APITokenFixtures;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
use ApiPlatform\Symfony\Bundle\Test\Client;
|
use ApiPlatform\Symfony\Bundle\Test\Client;
|
||||||
class APITokenAuthenticationTest extends ApiTestCase
|
final class APITokenAuthenticationTest extends ApiTestCase
|
||||||
{
|
{
|
||||||
public function testUnauthenticated(): void
|
public function testUnauthenticated(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\AuthenticatedApiTestCase;
|
use App\Tests\API\AuthenticatedApiTestCase;
|
||||||
|
|
||||||
class ApiTokenEnpointTest extends AuthenticatedApiTestCase
|
final class ApiTokenEnpointTest extends AuthenticatedApiTestCase
|
||||||
{
|
{
|
||||||
public function testGetCurrentToken(): void
|
public function testGetCurrentToken(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class AttachmentTypeEndpointTest extends CrudEndpointTestCase
|
final class AttachmentTypeEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\AuthenticatedApiTestCase;
|
use App\Tests\API\AuthenticatedApiTestCase;
|
||||||
|
|
||||||
class AttachmentsEndpointTest extends AuthenticatedApiTestCase
|
final class AttachmentsEndpointTest extends AuthenticatedApiTestCase
|
||||||
{
|
{
|
||||||
public function testGetCollection(): void
|
public function testGetCollection(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class CategoryEndpointTest extends CrudEndpointTestCase
|
final class CategoryEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ declare(strict_types=1);
|
||||||
namespace App\Tests\API\Endpoints;
|
namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
|
|
||||||
class CurrencyEndpointTest extends CrudEndpointTestCase
|
final class CurrencyEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class FootprintsEndpointTest extends CrudEndpointTestCase
|
final class FootprintsEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\AuthenticatedApiTestCase;
|
use App\Tests\API\AuthenticatedApiTestCase;
|
||||||
|
|
||||||
class InfoEndpointTest extends AuthenticatedApiTestCase
|
final class InfoEndpointTest extends AuthenticatedApiTestCase
|
||||||
{
|
{
|
||||||
public function testGetInfo(): void
|
public function testGetInfo(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class ManufacturersEndpointTest extends CrudEndpointTestCase
|
final class ManufacturersEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Tests\API\Endpoints;
|
namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
class MeasurementUnitsEndpointTest extends CrudEndpointTestCase
|
final class MeasurementUnitsEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class OrderdetailsEndpointTest extends CrudEndpointTestCase
|
final class OrderdetailsEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Tests\API\Endpoints;
|
namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
class ParametersEndpointTest extends CrudEndpointTestCase
|
final class ParametersEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class PartAssociationsEndpointTest extends CrudEndpointTestCase
|
final class PartAssociationsEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Tests\API\Endpoints;
|
namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
class PartCustomStateEndpointTest extends CrudEndpointTestCase
|
final class PartCustomStateEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Tests\API\Endpoints;
|
namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
class PartEndpointTest extends CrudEndpointTestCase
|
final class PartEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class PartLotsEndpointTest extends CrudEndpointTestCase
|
final class PartLotsEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class PricedetailsEndpointTest extends CrudEndpointTestCase
|
final class PricedetailsEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Tests\API\Endpoints;
|
namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
class ProjectBOMEntriesEndpointTest extends CrudEndpointTestCase
|
final class ProjectBOMEntriesEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class ProjectsEndpointTest extends CrudEndpointTestCase
|
final class ProjectsEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class StorageLocationsEndpointTest extends CrudEndpointTestCase
|
final class StorageLocationsEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
use App\Tests\API\Endpoints\CrudEndpointTestCase;
|
||||||
|
|
||||||
class SuppliersEndpointTest extends CrudEndpointTestCase
|
final class SuppliersEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Tests\API\Endpoints;
|
namespace App\Tests\API\Endpoints;
|
||||||
|
|
||||||
class UsersEndpointTest extends CrudEndpointTestCase
|
final class UsersEndpointTest extends CrudEndpointTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
protected function getBasePath(): string
|
protected function getBasePath(): string
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
*/
|
*/
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
class ApplicationAvailabilityFunctionalTest extends WebTestCase
|
final class ApplicationAvailabilityFunctionalTest extends WebTestCase
|
||||||
{
|
{
|
||||||
#[DataProvider('urlProvider')]
|
#[DataProvider('urlProvider')]
|
||||||
public function testPageIsSuccessful(string $url): void
|
public function testPageIsSuccessful(string $url): void
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Entity\Attachments\AttachmentType;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class AttachmentTypeController extends AbstractAdminController
|
final class AttachmentTypeController extends AbstractAdminController
|
||||||
{
|
{
|
||||||
protected static string $base_path = '/en/attachment_type';
|
protected static string $base_path = '/en/attachment_type';
|
||||||
protected static string $entity_class = AttachmentType::class;
|
protected static string $entity_class = AttachmentType::class;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Entity\Parts\Category;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class CategoryController extends AbstractAdminController
|
final class CategoryController extends AbstractAdminController
|
||||||
{
|
{
|
||||||
protected static string $base_path = '/en/category';
|
protected static string $base_path = '/en/category';
|
||||||
protected static string $entity_class = Category::class;
|
protected static string $entity_class = Category::class;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use App\Entity\Parts\Manufacturer;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class CurrencyController extends AbstractAdminController
|
final class CurrencyController extends AbstractAdminController
|
||||||
{
|
{
|
||||||
protected static string $base_path = '/en/currency';
|
protected static string $base_path = '/en/currency';
|
||||||
protected static string $entity_class = Currency::class;
|
protected static string $entity_class = Currency::class;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Entity\Parts\Footprint;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class FootprintController extends AbstractAdminController
|
final class FootprintController extends AbstractAdminController
|
||||||
{
|
{
|
||||||
protected static string $base_path = '/en/footprint';
|
protected static string $base_path = '/en/footprint';
|
||||||
protected static string $entity_class = Footprint::class;
|
protected static string $entity_class = Footprint::class;
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ use PHPUnit\Framework\Attributes\Group;
|
||||||
use App\Entity\LabelSystem\LabelProfile;
|
use App\Entity\LabelSystem\LabelProfile;
|
||||||
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
|
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 $base_path = '/en/label_profile';
|
||||||
protected static string $entity_class = LabelProfile::class;
|
protected static string $entity_class = LabelProfile::class;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Entity\Parts\Manufacturer;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class ManufacturerController extends AbstractAdminController
|
final class ManufacturerController extends AbstractAdminController
|
||||||
{
|
{
|
||||||
protected static string $base_path = '/en/manufacturer';
|
protected static string $base_path = '/en/manufacturer';
|
||||||
protected static string $entity_class = Manufacturer::class;
|
protected static string $entity_class = Manufacturer::class;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Entity\Parts\MeasurementUnit;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class MeasurementUnitController extends AbstractAdminController
|
final class MeasurementUnitController extends AbstractAdminController
|
||||||
{
|
{
|
||||||
protected static string $base_path = '/en/measurement_unit';
|
protected static string $base_path = '/en/measurement_unit';
|
||||||
protected static string $entity_class = MeasurementUnit::class;
|
protected static string $entity_class = MeasurementUnit::class;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use PHPUnit\Framework\Attributes\Group;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class PartCustomStateControllerTest extends AbstractAdminController
|
final class PartCustomStateControllerTest extends AbstractAdminController
|
||||||
{
|
{
|
||||||
protected static string $base_path = '/en/part_custom_state';
|
protected static string $base_path = '/en/part_custom_state';
|
||||||
protected static string $entity_class = PartCustomState::class;
|
protected static string $entity_class = PartCustomState::class;
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use App\Entity\ProjectSystem\Project;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class ProjectController extends AbstractAdminController
|
final class ProjectController extends AbstractAdminController
|
||||||
{
|
{
|
||||||
protected static string $base_path = '/en/project';
|
protected static string $base_path = '/en/project';
|
||||||
protected static string $entity_class = Project::class;
|
protected static string $entity_class = Project::class;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Entity\Parts\StorageLocation;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class StorelocationController extends AbstractAdminController
|
final class StorelocationController extends AbstractAdminController
|
||||||
{
|
{
|
||||||
protected static string $base_path = '/en/store_location';
|
protected static string $base_path = '/en/store_location';
|
||||||
protected static string $entity_class = StorageLocation::class;
|
protected static string $entity_class = StorageLocation::class;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Entity\Parts\Supplier;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class SupplierController extends AbstractAdminController
|
final class SupplierController extends AbstractAdminController
|
||||||
{
|
{
|
||||||
protected static string $base_path = '/en/supplier';
|
protected static string $base_path = '/en/supplier';
|
||||||
protected static string $entity_class = Supplier::class;
|
protected static string $entity_class = Supplier::class;
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Tests\Controller;
|
namespace App\Tests\Controller;
|
||||||
|
|
||||||
|
use App\Services\InfoProviderSystem\BulkInfoProviderService;
|
||||||
|
use App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO;
|
||||||
use App\Entity\InfoProviderSystem\BulkImportJobStatus;
|
use App\Entity\InfoProviderSystem\BulkImportJobStatus;
|
||||||
use App\Entity\InfoProviderSystem\BulkInfoProviderImportJob;
|
use App\Entity\InfoProviderSystem\BulkInfoProviderImportJob;
|
||||||
use App\Entity\Parts\Part;
|
use App\Entity\Parts\Part;
|
||||||
|
|
@ -36,7 +38,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
#[Group("slow")]
|
#[Group("slow")]
|
||||||
#[Group("DB")]
|
#[Group("DB")]
|
||||||
class BulkInfoProviderImportControllerTest extends WebTestCase
|
final class BulkInfoProviderImportControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
public function testStep1WithoutIds(): void
|
public function testStep1WithoutIds(): void
|
||||||
{
|
{
|
||||||
|
|
@ -174,8 +176,8 @@ class BulkInfoProviderImportControllerTest extends WebTestCase
|
||||||
|
|
||||||
// Verify the template rendered the source_field and source_keyword correctly
|
// Verify the template rendered the source_field and source_keyword correctly
|
||||||
$content = $client->getResponse()->getContent();
|
$content = $client->getResponse()->getContent();
|
||||||
$this->assertStringContainsString('test_field', $content);
|
$this->assertStringContainsString('test_field', (string) $content);
|
||||||
$this->assertStringContainsString('test_keyword', $content);
|
$this->assertStringContainsString('test_keyword', (string) $content);
|
||||||
|
|
||||||
// Clean up - find by ID to avoid detached entity issues
|
// Clean up - find by ID to avoid detached entity issues
|
||||||
$jobId = $job->getId();
|
$jobId = $job->getId();
|
||||||
|
|
@ -607,7 +609,7 @@ class BulkInfoProviderImportControllerTest extends WebTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertResponseStatusCodeSame(Response::HTTP_OK);
|
$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
|
public function testStep1FormSubmissionWithErrors(): void
|
||||||
|
|
@ -630,7 +632,7 @@ class BulkInfoProviderImportControllerTest extends WebTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertResponseStatusCodeSame(Response::HTTP_OK);
|
$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
|
public function testBulkInfoProviderServiceKeywordExtraction(): void
|
||||||
|
|
@ -647,18 +649,18 @@ class BulkInfoProviderImportControllerTest extends WebTestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that the service can extract keywords from parts
|
// 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
|
// Create field mappings to verify the service works
|
||||||
$fieldMappings = [
|
$fieldMappings = [
|
||||||
new \App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO('name', ['test'], 1),
|
new BulkSearchFieldMappingDTO('name', ['test'], 1),
|
||||||
new \App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO('mpn', ['test'], 2)
|
new BulkSearchFieldMappingDTO('mpn', ['test'], 2)
|
||||||
];
|
];
|
||||||
|
|
||||||
// The service may return an empty result or throw when no results are found
|
// The service may return an empty result or throw when no results are found
|
||||||
try {
|
try {
|
||||||
$result = $bulkService->performBulkSearch([$part], $fieldMappings, false);
|
$result = $bulkService->performBulkSearch([$part], $fieldMappings, false);
|
||||||
$this->assertInstanceOf(\App\Services\InfoProviderSystem\DTOs\BulkSearchResponseDTO::class, $result);
|
$this->assertInstanceOf(BulkSearchResponseDTO::class, $result);
|
||||||
} catch (\RuntimeException $e) {
|
} catch (\RuntimeException $e) {
|
||||||
$this->assertStringContainsString('No search results found', $e->getMessage());
|
$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
|
// 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
|
// Create field mappings with supplier SPN field mapping
|
||||||
$fieldMappings = [
|
$fieldMappings = [
|
||||||
new \App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO('invalid_field', ['test'], 1),
|
new BulkSearchFieldMappingDTO('invalid_field', ['test'], 1),
|
||||||
new \App\Services\InfoProviderSystem\DTOs\BulkSearchFieldMappingDTO('test_supplier_spn', ['test'], 2)
|
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
|
// 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
|
// 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
|
// Create field mappings with multiple keywords
|
||||||
$fieldMappings = [
|
$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
|
// 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
|
// 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
|
// Create empty search results to test prefetch method
|
||||||
$searchResults = new BulkSearchResponseDTO([
|
$searchResults = new BulkSearchResponseDTO([
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\DataFixtures\APITokenFixtures;
|
||||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class KiCadApiControllerTest extends WebTestCase
|
final class KiCadApiControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
private const BASE_URL = '/en/kicad-api/v1';
|
private const BASE_URL = '/en/kicad-api/v1';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
#[Group("slow")]
|
#[Group("slow")]
|
||||||
#[Group("DB")]
|
#[Group("DB")]
|
||||||
class PartControllerTest extends WebTestCase
|
final class PartControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
public function testShowPart(): void
|
public function testShowPart(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
#[Group('slow')]
|
#[Group('slow')]
|
||||||
#[Group('DB')]
|
#[Group('DB')]
|
||||||
class RedirectControllerTest extends WebTestCase
|
final class RedirectControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
protected EntityManagerInterface $em;
|
protected EntityManagerInterface $em;
|
||||||
protected UserRepository $userRepo;
|
protected UserRepository $userRepo;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\Controller;
|
||||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class ScanControllerTest extends WebTestCase
|
final class ScanControllerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private ?KernelBrowser $client = null;
|
private ?KernelBrowser $client = null;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\DataTables\Filters\FilterInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class CompoundFilterTraitTest extends TestCase
|
final class CompoundFilterTraitTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testFindAllChildFiltersEmpty(): void
|
public function testFindAllChildFiltersEmpty(): void
|
||||||
|
|
@ -49,9 +49,9 @@ class CompoundFilterTraitTest extends TestCase
|
||||||
|
|
||||||
public function testFindAllChildFilters(): void
|
public function testFindAllChildFilters(): void
|
||||||
{
|
{
|
||||||
$f1 = $this->createMock(FilterInterface::class);
|
$f1 = $this->createStub(FilterInterface::class);
|
||||||
$f2 = $this->createMock(FilterInterface::class);
|
$f2 = $this->createStub(FilterInterface::class);
|
||||||
$f3 = $this->createMock(FilterInterface::class);
|
$f3 = $this->createStub(FilterInterface::class);
|
||||||
|
|
||||||
$filter = new class($f1, $f2, $f3, null) {
|
$filter = new class($f1, $f2, $f3, null) {
|
||||||
use CompoundFilterTrait;
|
use CompoundFilterTrait;
|
||||||
|
|
@ -108,7 +108,7 @@ class CompoundFilterTraitTest extends TestCase
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$qb = $this->createMock(QueryBuilder::class);
|
$qb = $this->createStub(QueryBuilder::class);
|
||||||
$filter->_applyAllChildFilters($qb);
|
$filter->_applyAllChildFilters($qb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use App\DataTables\Filters\Constraints\FilterTrait;
|
use App\DataTables\Filters\Constraints\FilterTrait;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class FilterTraitTest extends TestCase
|
final class FilterTraitTest extends TestCase
|
||||||
{
|
{
|
||||||
use FilterTrait;
|
use FilterTrait;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class BulkImportJobStatusConstraintTest extends TestCase
|
final class BulkImportJobStatusConstraintTest extends TestCase
|
||||||
{
|
{
|
||||||
private BulkImportJobStatusConstraint $constraint;
|
private BulkImportJobStatusConstraint $constraint;
|
||||||
private QueryBuilder $queryBuilder;
|
private QueryBuilder $queryBuilder;
|
||||||
|
|
@ -46,7 +46,7 @@ class BulkImportJobStatusConstraintTest extends TestCase
|
||||||
|
|
||||||
public function testConstructor(): void
|
public function testConstructor(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals([], $this->constraint->getValue());
|
$this->assertSame([], $this->constraint->getValue());
|
||||||
$this->assertEmpty($this->constraint->getOperator());
|
$this->assertEmpty($this->constraint->getOperator());
|
||||||
$this->assertFalse($this->constraint->isEnabled());
|
$this->assertFalse($this->constraint->isEnabled());
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ class BulkImportJobStatusConstraintTest extends TestCase
|
||||||
$values = ['pending', 'in_progress'];
|
$values = ['pending', 'in_progress'];
|
||||||
$this->constraint->setValue($values);
|
$this->constraint->setValue($values);
|
||||||
|
|
||||||
$this->assertEquals($values, $this->constraint->getValue());
|
$this->assertSame($values, $this->constraint->getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAndSetOperator(): void
|
public function testGetAndSetOperator(): void
|
||||||
|
|
@ -64,7 +64,7 @@ class BulkImportJobStatusConstraintTest extends TestCase
|
||||||
$operator = 'ANY';
|
$operator = 'ANY';
|
||||||
$this->constraint->setOperator($operator);
|
$this->constraint->setOperator($operator);
|
||||||
|
|
||||||
$this->assertEquals($operator, $this->constraint->getOperator());
|
$this->assertSame($operator, $this->constraint->getOperator());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsEnabledWithEmptyValues(): void
|
public function testIsEnabledWithEmptyValues(): void
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class BulkImportPartStatusConstraintTest extends TestCase
|
final class BulkImportPartStatusConstraintTest extends TestCase
|
||||||
{
|
{
|
||||||
private BulkImportPartStatusConstraint $constraint;
|
private BulkImportPartStatusConstraint $constraint;
|
||||||
private QueryBuilder $queryBuilder;
|
private QueryBuilder $queryBuilder;
|
||||||
|
|
@ -46,7 +46,7 @@ class BulkImportPartStatusConstraintTest extends TestCase
|
||||||
|
|
||||||
public function testConstructor(): void
|
public function testConstructor(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals([], $this->constraint->getValue());
|
$this->assertSame([], $this->constraint->getValue());
|
||||||
$this->assertEmpty($this->constraint->getOperator());
|
$this->assertEmpty($this->constraint->getOperator());
|
||||||
$this->assertFalse($this->constraint->isEnabled());
|
$this->assertFalse($this->constraint->isEnabled());
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ class BulkImportPartStatusConstraintTest extends TestCase
|
||||||
$values = ['pending', 'completed', 'skipped'];
|
$values = ['pending', 'completed', 'skipped'];
|
||||||
$this->constraint->setValue($values);
|
$this->constraint->setValue($values);
|
||||||
|
|
||||||
$this->assertEquals($values, $this->constraint->getValue());
|
$this->assertSame($values, $this->constraint->getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAndSetOperator(): void
|
public function testGetAndSetOperator(): void
|
||||||
|
|
@ -64,7 +64,7 @@ class BulkImportPartStatusConstraintTest extends TestCase
|
||||||
$operator = 'ANY';
|
$operator = 'ANY';
|
||||||
$this->constraint->setOperator($operator);
|
$this->constraint->setOperator($operator);
|
||||||
|
|
||||||
$this->assertEquals($operator, $this->constraint->getOperator());
|
$this->assertSame($operator, $this->constraint->getOperator());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testIsEnabledWithEmptyValues(): void
|
public function testIsEnabledWithEmptyValues(): void
|
||||||
|
|
@ -294,6 +294,6 @@ class BulkImportPartStatusConstraintTest extends TestCase
|
||||||
|
|
||||||
$this->constraint->apply($this->queryBuilder);
|
$this->constraint->apply($this->queryBuilder);
|
||||||
|
|
||||||
$this->assertEquals($statusValues, $this->constraint->getValue());
|
$this->assertSame($statusValues, $this->constraint->getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ namespace App\Tests;
|
||||||
use PHPUnit\Framework\Attributes\DataProvider;
|
use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class DatatablesAvailabilityTest extends WebTestCase
|
final class DatatablesAvailabilityTest extends WebTestCase
|
||||||
{
|
{
|
||||||
#[DataProvider('urlProvider')]
|
#[DataProvider('urlProvider')]
|
||||||
public function testDataTable(string $url, ?array $ordering = null): void
|
public function testDataTable(string $url, ?array $ordering = null): void
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use App\Doctrine\Middleware\SQLiteRegexExtensionMiddlewareDriver;
|
use App\Doctrine\Middleware\SQLiteRegexExtensionMiddlewareDriver;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class SQLiteRegexMiddlewareTest extends TestCase
|
final class SQLiteRegexMiddlewareTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function regexpDataProvider(): \Generator
|
public static function regexpDataProvider(): \Generator
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ use InvalidArgumentException;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
|
|
||||||
class AttachmentTest extends TestCase
|
final class AttachmentTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testEmptyState(): void
|
public function testEmptyState(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use App\Entity\Attachments\UserAttachment;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class AttachmentTypeTest extends TestCase
|
final class AttachmentTypeTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testEmptyState(): void
|
public function testEmptyState(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
* Test StructuralDBElement entities.
|
* Test StructuralDBElement entities.
|
||||||
* Note: Because StructuralDBElement is abstract we use AttachmentType here as a placeholder.
|
* 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 $root;
|
||||||
protected AttachmentType $child1;
|
protected AttachmentType $child1;
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\Entity;
|
||||||
use App\Entity\InfoProviderSystem\BulkImportJobStatus;
|
use App\Entity\InfoProviderSystem\BulkImportJobStatus;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class BulkImportJobStatusTest extends TestCase
|
final class BulkImportJobStatusTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testEnumValues(): void
|
public function testEnumValues(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,32 +28,27 @@ use App\Entity\InfoProviderSystem\BulkInfoProviderImportJobPart;
|
||||||
use App\Entity\Parts\Part;
|
use App\Entity\Parts\Part;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class BulkInfoProviderImportJobPartTest extends TestCase
|
final class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
{
|
{
|
||||||
private BulkInfoProviderImportJob $job;
|
|
||||||
private Part $part;
|
|
||||||
private BulkInfoProviderImportJobPart $jobPart;
|
private BulkInfoProviderImportJobPart $jobPart;
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->job = $this->createMock(BulkInfoProviderImportJob::class);
|
$this->jobPart = new BulkInfoProviderImportJobPart($this->createStub(BulkInfoProviderImportJob::class), $this->createStub(Part::class));
|
||||||
$this->part = $this->createMock(Part::class);
|
|
||||||
|
|
||||||
$this->jobPart = new BulkInfoProviderImportJobPart($this->job, $this->part);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testConstructor(): void
|
public function testConstructor(): void
|
||||||
{
|
{
|
||||||
$this->assertSame($this->job, $this->jobPart->getJob());
|
$this->assertSame($this->createStub(BulkInfoProviderImportJob::class), $this->jobPart->getJob());
|
||||||
$this->assertSame($this->part, $this->jobPart->getPart());
|
$this->assertSame($this->createStub(Part::class), $this->jobPart->getPart());
|
||||||
$this->assertEquals(BulkImportPartStatus::PENDING, $this->jobPart->getStatus());
|
$this->assertSame(BulkImportPartStatus::PENDING, $this->jobPart->getStatus());
|
||||||
$this->assertNull($this->jobPart->getReason());
|
$this->assertNull($this->jobPart->getReason());
|
||||||
$this->assertNull($this->jobPart->getCompletedAt());
|
$this->assertNull($this->jobPart->getCompletedAt());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAndSetJob(): void
|
public function testGetAndSetJob(): void
|
||||||
{
|
{
|
||||||
$newJob = $this->createMock(BulkInfoProviderImportJob::class);
|
$newJob = $this->createStub(BulkInfoProviderImportJob::class);
|
||||||
|
|
||||||
$result = $this->jobPart->setJob($newJob);
|
$result = $this->jobPart->setJob($newJob);
|
||||||
|
|
||||||
|
|
@ -63,7 +58,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
|
|
||||||
public function testGetAndSetPart(): void
|
public function testGetAndSetPart(): void
|
||||||
{
|
{
|
||||||
$newPart = $this->createMock(Part::class);
|
$newPart = $this->createStub(Part::class);
|
||||||
|
|
||||||
$result = $this->jobPart->setPart($newPart);
|
$result = $this->jobPart->setPart($newPart);
|
||||||
|
|
||||||
|
|
@ -76,7 +71,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
$result = $this->jobPart->setStatus(BulkImportPartStatus::COMPLETED);
|
$result = $this->jobPart->setStatus(BulkImportPartStatus::COMPLETED);
|
||||||
|
|
||||||
$this->assertSame($this->jobPart, $result);
|
$this->assertSame($this->jobPart, $result);
|
||||||
$this->assertEquals(BulkImportPartStatus::COMPLETED, $this->jobPart->getStatus());
|
$this->assertSame(BulkImportPartStatus::COMPLETED, $this->jobPart->getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAndSetReason(): void
|
public function testGetAndSetReason(): void
|
||||||
|
|
@ -86,7 +81,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
$result = $this->jobPart->setReason($reason);
|
$result = $this->jobPart->setReason($reason);
|
||||||
|
|
||||||
$this->assertSame($this->jobPart, $result);
|
$this->assertSame($this->jobPart, $result);
|
||||||
$this->assertEquals($reason, $this->jobPart->getReason());
|
$this->assertSame($reason, $this->jobPart->getReason());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetAndSetCompletedAt(): void
|
public function testGetAndSetCompletedAt(): void
|
||||||
|
|
@ -108,7 +103,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
$afterTime = new \DateTimeImmutable();
|
$afterTime = new \DateTimeImmutable();
|
||||||
|
|
||||||
$this->assertSame($this->jobPart, $result);
|
$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->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
||||||
$this->assertGreaterThanOrEqual($beforeTime, $this->jobPart->getCompletedAt());
|
$this->assertGreaterThanOrEqual($beforeTime, $this->jobPart->getCompletedAt());
|
||||||
$this->assertLessThanOrEqual($afterTime, $this->jobPart->getCompletedAt());
|
$this->assertLessThanOrEqual($afterTime, $this->jobPart->getCompletedAt());
|
||||||
|
|
@ -124,8 +119,8 @@ class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
$afterTime = new \DateTimeImmutable();
|
$afterTime = new \DateTimeImmutable();
|
||||||
|
|
||||||
$this->assertSame($this->jobPart, $result);
|
$this->assertSame($this->jobPart, $result);
|
||||||
$this->assertEquals(BulkImportPartStatus::SKIPPED, $this->jobPart->getStatus());
|
$this->assertSame(BulkImportPartStatus::SKIPPED, $this->jobPart->getStatus());
|
||||||
$this->assertEquals($reason, $this->jobPart->getReason());
|
$this->assertSame($reason, $this->jobPart->getReason());
|
||||||
$this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
$this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
||||||
$this->assertGreaterThanOrEqual($beforeTime, $this->jobPart->getCompletedAt());
|
$this->assertGreaterThanOrEqual($beforeTime, $this->jobPart->getCompletedAt());
|
||||||
$this->assertLessThanOrEqual($afterTime, $this->jobPart->getCompletedAt());
|
$this->assertLessThanOrEqual($afterTime, $this->jobPart->getCompletedAt());
|
||||||
|
|
@ -136,8 +131,8 @@ class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
$result = $this->jobPart->markAsSkipped();
|
$result = $this->jobPart->markAsSkipped();
|
||||||
|
|
||||||
$this->assertSame($this->jobPart, $result);
|
$this->assertSame($this->jobPart, $result);
|
||||||
$this->assertEquals(BulkImportPartStatus::SKIPPED, $this->jobPart->getStatus());
|
$this->assertSame(BulkImportPartStatus::SKIPPED, $this->jobPart->getStatus());
|
||||||
$this->assertEquals('', $this->jobPart->getReason());
|
$this->assertSame('', $this->jobPart->getReason());
|
||||||
$this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
$this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,8 +146,8 @@ class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
$afterTime = new \DateTimeImmutable();
|
$afterTime = new \DateTimeImmutable();
|
||||||
|
|
||||||
$this->assertSame($this->jobPart, $result);
|
$this->assertSame($this->jobPart, $result);
|
||||||
$this->assertEquals(BulkImportPartStatus::FAILED, $this->jobPart->getStatus());
|
$this->assertSame(BulkImportPartStatus::FAILED, $this->jobPart->getStatus());
|
||||||
$this->assertEquals($reason, $this->jobPart->getReason());
|
$this->assertSame($reason, $this->jobPart->getReason());
|
||||||
$this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
$this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
||||||
$this->assertGreaterThanOrEqual($beforeTime, $this->jobPart->getCompletedAt());
|
$this->assertGreaterThanOrEqual($beforeTime, $this->jobPart->getCompletedAt());
|
||||||
$this->assertLessThanOrEqual($afterTime, $this->jobPart->getCompletedAt());
|
$this->assertLessThanOrEqual($afterTime, $this->jobPart->getCompletedAt());
|
||||||
|
|
@ -163,8 +158,8 @@ class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
$result = $this->jobPart->markAsFailed();
|
$result = $this->jobPart->markAsFailed();
|
||||||
|
|
||||||
$this->assertSame($this->jobPart, $result);
|
$this->assertSame($this->jobPart, $result);
|
||||||
$this->assertEquals(BulkImportPartStatus::FAILED, $this->jobPart->getStatus());
|
$this->assertSame(BulkImportPartStatus::FAILED, $this->jobPart->getStatus());
|
||||||
$this->assertEquals('', $this->jobPart->getReason());
|
$this->assertSame('', $this->jobPart->getReason());
|
||||||
$this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
$this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,7 +171,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
$result = $this->jobPart->markAsPending();
|
$result = $this->jobPart->markAsPending();
|
||||||
|
|
||||||
$this->assertSame($this->jobPart, $result);
|
$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->getReason());
|
||||||
$this->assertNull($this->jobPart->getCompletedAt());
|
$this->assertNull($this->jobPart->getCompletedAt());
|
||||||
}
|
}
|
||||||
|
|
@ -281,7 +276,7 @@ class BulkInfoProviderImportJobPartTest extends TestCase
|
||||||
|
|
||||||
// After marking as skipped, should have reason and completion time
|
// After marking as skipped, should have reason and completion time
|
||||||
$this->jobPart->markAsSkipped('Skipped reason');
|
$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());
|
$this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
||||||
|
|
||||||
// After marking as pending, reason and completion time should be cleared
|
// 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
|
// After marking as failed, should have reason and completion time
|
||||||
$this->jobPart->markAsFailed('Failed reason');
|
$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());
|
$this->assertInstanceOf(\DateTimeImmutable::class, $this->jobPart->getCompletedAt());
|
||||||
|
|
||||||
// After marking as completed, should have completion time (reason may remain from previous state)
|
// After marking as completed, should have completion time (reason may remain from previous state)
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,8 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Tests\Entity;
|
namespace App\Tests\Entity;
|
||||||
|
|
||||||
|
use App\Entity\Parts\Part;
|
||||||
|
use App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultsDTO;
|
||||||
use App\Entity\InfoProviderSystem\BulkImportJobStatus;
|
use App\Entity\InfoProviderSystem\BulkImportJobStatus;
|
||||||
use App\Entity\InfoProviderSystem\BulkInfoProviderImportJob;
|
use App\Entity\InfoProviderSystem\BulkInfoProviderImportJob;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
|
|
@ -31,7 +33,7 @@ use App\Services\InfoProviderSystem\DTOs\BulkSearchResponseDTO;
|
||||||
use App\Services\InfoProviderSystem\DTOs\SearchResultDTO;
|
use App\Services\InfoProviderSystem\DTOs\SearchResultDTO;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class BulkInfoProviderImportJobTest extends TestCase
|
final class BulkInfoProviderImportJobTest extends TestCase
|
||||||
{
|
{
|
||||||
private BulkInfoProviderImportJob $job;
|
private BulkInfoProviderImportJob $job;
|
||||||
private User $user;
|
private User $user;
|
||||||
|
|
@ -45,9 +47,9 @@ class BulkInfoProviderImportJobTest extends TestCase
|
||||||
$this->job->setCreatedBy($this->user);
|
$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('getId')->willReturn($id);
|
||||||
$part->method('getName')->willReturn("Test Part {$id}");
|
$part->method('getName')->willReturn("Test Part {$id}");
|
||||||
return $part;
|
return $part;
|
||||||
|
|
@ -58,7 +60,7 @@ class BulkInfoProviderImportJobTest extends TestCase
|
||||||
$job = new BulkInfoProviderImportJob();
|
$job = new BulkInfoProviderImportJob();
|
||||||
|
|
||||||
$this->assertInstanceOf(\DateTimeImmutable::class, $job->getCreatedAt());
|
$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->getPartIds());
|
||||||
$this->assertEmpty($job->getFieldMappings());
|
$this->assertEmpty($job->getFieldMappings());
|
||||||
$this->assertEmpty($job->getSearchResultsRaw());
|
$this->assertEmpty($job->getSearchResultsRaw());
|
||||||
|
|
@ -70,14 +72,14 @@ class BulkInfoProviderImportJobTest extends TestCase
|
||||||
public function testBasicGettersSetters(): void
|
public function testBasicGettersSetters(): void
|
||||||
{
|
{
|
||||||
$this->job->setName('Test Job');
|
$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
|
// Test with actual parts - this is what actually works
|
||||||
$parts = [$this->createMockPart(1), $this->createMockPart(2), $this->createMockPart(3)];
|
$parts = [$this->createMockPart(1), $this->createMockPart(2), $this->createMockPart(3)];
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
$this->job->addPart($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'])];
|
$fieldMappings = [new BulkSearchFieldMappingDTO(field: 'field1', providers: ['provider1', 'provider2'])];
|
||||||
$this->job->setFieldMappings($fieldMappings);
|
$this->job->setFieldMappings($fieldMappings);
|
||||||
|
|
@ -98,24 +100,24 @@ class BulkInfoProviderImportJobTest extends TestCase
|
||||||
$this->assertFalse($this->job->isStopped());
|
$this->assertFalse($this->job->isStopped());
|
||||||
|
|
||||||
$this->job->markAsInProgress();
|
$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->assertTrue($this->job->isInProgress());
|
||||||
$this->assertFalse($this->job->isPending());
|
$this->assertFalse($this->job->isPending());
|
||||||
|
|
||||||
$this->job->markAsCompleted();
|
$this->job->markAsCompleted();
|
||||||
$this->assertEquals(BulkImportJobStatus::COMPLETED, $this->job->getStatus());
|
$this->assertSame(BulkImportJobStatus::COMPLETED, $this->job->getStatus());
|
||||||
$this->assertTrue($this->job->isCompleted());
|
$this->assertTrue($this->job->isCompleted());
|
||||||
$this->assertNotNull($this->job->getCompletedAt());
|
$this->assertNotNull($this->job->getCompletedAt());
|
||||||
|
|
||||||
$job2 = new BulkInfoProviderImportJob();
|
$job2 = new BulkInfoProviderImportJob();
|
||||||
$job2->markAsFailed();
|
$job2->markAsFailed();
|
||||||
$this->assertEquals(BulkImportJobStatus::FAILED, $job2->getStatus());
|
$this->assertSame(BulkImportJobStatus::FAILED, $job2->getStatus());
|
||||||
$this->assertTrue($job2->isFailed());
|
$this->assertTrue($job2->isFailed());
|
||||||
$this->assertNotNull($job2->getCompletedAt());
|
$this->assertNotNull($job2->getCompletedAt());
|
||||||
|
|
||||||
$job3 = new BulkInfoProviderImportJob();
|
$job3 = new BulkInfoProviderImportJob();
|
||||||
$job3->markAsStopped();
|
$job3->markAsStopped();
|
||||||
$this->assertEquals(BulkImportJobStatus::STOPPED, $job3->getStatus());
|
$this->assertSame(BulkImportJobStatus::STOPPED, $job3->getStatus());
|
||||||
$this->assertTrue($job3->isStopped());
|
$this->assertTrue($job3->isStopped());
|
||||||
$this->assertNotNull($job3->getCompletedAt());
|
$this->assertNotNull($job3->getCompletedAt());
|
||||||
}
|
}
|
||||||
|
|
@ -139,7 +141,7 @@ class BulkInfoProviderImportJobTest extends TestCase
|
||||||
|
|
||||||
public function testPartCount(): void
|
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
|
// Test with actual parts - setPartIds doesn't actually add parts
|
||||||
$parts = [
|
$parts = [
|
||||||
|
|
@ -152,31 +154,31 @@ class BulkInfoProviderImportJobTest extends TestCase
|
||||||
foreach ($parts as $part) {
|
foreach ($parts as $part) {
|
||||||
$this->job->addPart($part);
|
$this->job->addPart($part);
|
||||||
}
|
}
|
||||||
$this->assertEquals(5, $this->job->getPartCount());
|
$this->assertSame(5, $this->job->getPartCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testResultCount(): void
|
public function testResultCount(): void
|
||||||
{
|
{
|
||||||
$this->assertEquals(0, $this->job->getResultCount());
|
$this->assertSame(0, $this->job->getResultCount());
|
||||||
|
|
||||||
$searchResults = new BulkSearchResponseDTO([
|
$searchResults = new BulkSearchResponseDTO([
|
||||||
new \App\Services\InfoProviderSystem\DTOs\BulkSearchPartResultsDTO(
|
new BulkSearchPartResultsDTO(
|
||||||
part: $this->createMockPart(1),
|
part: $this->createMockPart(1),
|
||||||
searchResults: [new BulkSearchPartResultDTO(searchResult: new SearchResultDTO(provider_key: 'dummy', provider_id: '1234', name: 'Part 1', description: 'A part'))]
|
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),
|
part: $this->createMockPart(2),
|
||||||
searchResults: [new BulkSearchPartResultDTO(searchResult: new SearchResultDTO(provider_key: 'dummy', provider_id: '1234', name: 'Part 2', description: 'A part')),
|
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 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),
|
part: $this->createMockPart(3),
|
||||||
searchResults: []
|
searchResults: []
|
||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->job->setSearchResults($searchResults);
|
$this->job->setSearchResults($searchResults);
|
||||||
$this->assertEquals(3, $this->job->getResultCount());
|
$this->assertSame(3, $this->job->getResultCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPartProgressTracking(): void
|
public function testPartProgressTracking(): void
|
||||||
|
|
@ -222,21 +224,21 @@ class BulkInfoProviderImportJobTest extends TestCase
|
||||||
$this->job->addPart($part);
|
$this->job->addPart($part);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertEquals(0, $this->job->getCompletedPartsCount());
|
$this->assertSame(0, $this->job->getCompletedPartsCount());
|
||||||
$this->assertEquals(0, $this->job->getSkippedPartsCount());
|
$this->assertSame(0, $this->job->getSkippedPartsCount());
|
||||||
|
|
||||||
$this->job->markPartAsCompleted(1);
|
$this->job->markPartAsCompleted(1);
|
||||||
$this->job->markPartAsCompleted(2);
|
$this->job->markPartAsCompleted(2);
|
||||||
$this->job->markPartAsSkipped(3, 'Error');
|
$this->job->markPartAsSkipped(3, 'Error');
|
||||||
|
|
||||||
$this->assertEquals(2, $this->job->getCompletedPartsCount());
|
$this->assertSame(2, $this->job->getCompletedPartsCount());
|
||||||
$this->assertEquals(1, $this->job->getSkippedPartsCount());
|
$this->assertSame(1, $this->job->getSkippedPartsCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testProgressPercentage(): void
|
public function testProgressPercentage(): void
|
||||||
{
|
{
|
||||||
$emptyJob = new BulkInfoProviderImportJob();
|
$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
|
// Test with actual parts - setPartIds doesn't actually add parts
|
||||||
$parts = [
|
$parts = [
|
||||||
|
|
@ -250,18 +252,18 @@ class BulkInfoProviderImportJobTest extends TestCase
|
||||||
$this->job->addPart($part);
|
$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(1);
|
||||||
$this->job->markPartAsCompleted(2);
|
$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->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(4);
|
||||||
$this->job->markPartAsCompleted(5);
|
$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
|
public function testIsAllPartsCompleted(): void
|
||||||
|
|
@ -301,8 +303,8 @@ class BulkInfoProviderImportJobTest extends TestCase
|
||||||
$this->job->addPart($part);
|
$this->job->addPart($part);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->assertEquals('info_providers.bulk_import.job_name_template', $this->job->getDisplayNameKey());
|
$this->assertSame('info_providers.bulk_import.job_name_template', $this->job->getDisplayNameKey());
|
||||||
$this->assertEquals(['%count%' => 3], $this->job->getDisplayNameParams());
|
$this->assertSame(['%count%' => 3], $this->job->getDisplayNameParams());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFormattedTimestamp(): void
|
public function testFormattedTimestamp(): void
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ use App\Entity\UserSystem\Group;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class AbstractLogEntryTest extends TestCase
|
final class AbstractLogEntryTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testSetGetTarget(): void
|
public function testSetGetTarget(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\Entity\LogSystem;
|
||||||
use App\Entity\LogSystem\LogLevel;
|
use App\Entity\LogSystem\LogLevel;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class LogLevelTest extends TestCase
|
final class LogLevelTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testToPSR3LevelString(): void
|
public function testToPSR3LevelString(): void
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ use App\Entity\Parts\Category;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class LogTargetTypeTest extends TestCase
|
final class LogTargetTypeTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testToClass(): void
|
public function testToClass(): void
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use App\Entity\Parameters\PartParameter;
|
use App\Entity\Parameters\PartParameter;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class PartParameterTest extends TestCase
|
final class PartParameterTest extends TestCase
|
||||||
{
|
{
|
||||||
public static function valueWithUnitDataProvider(): \Iterator
|
public static function valueWithUnitDataProvider(): \Iterator
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use App\Entity\Parts\InfoProviderReference;
|
||||||
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
|
use App\Services\InfoProviderSystem\DTOs\PartDetailDTO;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class InfoProviderReferenceTest extends TestCase
|
final class InfoProviderReferenceTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testNoProvider(): void
|
public function testNoProvider(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use App\Entity\Parts\AssociationType;
|
||||||
use App\Entity\Parts\PartAssociation;
|
use App\Entity\Parts\PartAssociation;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class PartAssociationTest extends TestCase
|
final class PartAssociationTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testGetTypeTranslationKey(): void
|
public function testGetTypeTranslationKey(): void
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use App\Entity\Parts\PartLot;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class PartLotTest extends TestCase
|
final class PartLotTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testIsExpired(): void
|
public function testIsExpired(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use DateTime;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class PartTest extends TestCase
|
final class PartTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testAddRemovePartLot(): void
|
public function testAddRemovePartLot(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use App\Entity\PriceInformations\Currency;
|
||||||
use Brick\Math\BigDecimal;
|
use Brick\Math\BigDecimal;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class CurrencyTest extends TestCase
|
final class CurrencyTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testGetInverseExchangeRate(): void
|
public function testGetInverseExchangeRate(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Entity\PriceInformations\Pricedetail;
|
||||||
use Doctrine\Common\Collections\Collection;
|
use Doctrine\Common\Collections\Collection;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class OrderdetailTest extends TestCase
|
final class OrderdetailTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testAddRemovePricdetails(): void
|
public function testAddRemovePricdetails(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use App\Entity\PriceInformations\Pricedetail;
|
||||||
use Brick\Math\BigDecimal;
|
use Brick\Math\BigDecimal;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class PricedetailTest extends TestCase
|
final class PricedetailTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testGetPricePerUnit(): void
|
public function testGetPricePerUnit(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\Entity\UserSystem;
|
||||||
use App\Entity\UserSystem\ApiTokenType;
|
use App\Entity\UserSystem\ApiTokenType;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ApiTokenTypeTest extends TestCase
|
final class ApiTokenTypeTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testGetTokenPrefix(): void
|
public function testGetTokenPrefix(): void
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\Entity\UserSystem;
|
||||||
use App\Entity\UserSystem\PermissionData;
|
use App\Entity\UserSystem\PermissionData;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class PermissionDataTest extends TestCase
|
final class PermissionDataTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testGetSetIs(): void
|
public function testGetSetIs(): void
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Component\Uid\Uuid;
|
use Symfony\Component\Uid\Uuid;
|
||||||
use Webauthn\TrustPath\EmptyTrustPath;
|
use Webauthn\TrustPath\EmptyTrustPath;
|
||||||
|
|
||||||
class UserTest extends TestCase
|
final class UserTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testGetFullName(): void
|
public function testGetFullName(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||||
*
|
*
|
||||||
|
|
@ -17,13 +20,12 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Tests\EnvVarProcessors;
|
namespace App\Tests\EnvVarProcessors;
|
||||||
|
|
||||||
use App\EnvVarProcessors\AddSlashEnvVarProcessor;
|
use App\EnvVarProcessors\AddSlashEnvVarProcessor;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class AddSlashEnvVarProcessorTest extends TestCase
|
final class AddSlashEnvVarProcessorTest extends TestCase
|
||||||
{
|
{
|
||||||
protected AddSlashEnvVarProcessor $processor;
|
protected AddSlashEnvVarProcessor $processor;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||||
*
|
*
|
||||||
|
|
@ -17,14 +20,13 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Tests\EventListener;
|
namespace App\Tests\EventListener;
|
||||||
|
|
||||||
use App\EventListener\RegisterSynonymsAsTranslationParametersListener;
|
use App\EventListener\RegisterSynonymsAsTranslationParametersListener;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
class RegisterSynonymsAsTranslationParametersTest extends KernelTestCase
|
final class RegisterSynonymsAsTranslationParametersTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private RegisterSynonymsAsTranslationParametersListener $listener;
|
private RegisterSynonymsAsTranslationParametersListener $listener;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
|
||||||
use Symfony\Component\Uid\Uuid;
|
use Symfony\Component\Uid\Uuid;
|
||||||
use Webauthn\TrustPath\EmptyTrustPath;
|
use Webauthn\TrustPath\EmptyTrustPath;
|
||||||
|
|
||||||
class PasswordChangeNeededSubscriberTest extends TestCase
|
final class PasswordChangeNeededSubscriberTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testTFARedirectNeeded(): void
|
public function testTFARedirectNeeded(): void
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
use Twig\Error\Error;
|
use Twig\Error\Error;
|
||||||
|
|
||||||
class TwigModeExceptionTest extends KernelTestCase
|
final class TwigModeExceptionTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private string $projectPath;
|
private string $projectPath;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use Symfony\Component\Form\FormFactoryInterface;
|
||||||
|
|
||||||
#[Group("slow")]
|
#[Group("slow")]
|
||||||
#[Group("DB")]
|
#[Group("DB")]
|
||||||
class GlobalFieldMappingTypeTest extends KernelTestCase
|
final class GlobalFieldMappingTypeTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
private FormFactoryInterface $formFactory;
|
private FormFactoryInterface $formFactory;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use App\Helpers\BBCodeToMarkdownConverter;
|
use App\Helpers\BBCodeToMarkdownConverter;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class BBCodeToMarkdownConverterTest extends TestCase
|
final class BBCodeToMarkdownConverterTest extends TestCase
|
||||||
{
|
{
|
||||||
protected BBCodeToMarkdownConverter $converter;
|
protected BBCodeToMarkdownConverter $converter;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use App\Helpers\IPAnonymizer;
|
use App\Helpers\IPAnonymizer;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class IPAnonymizerTest extends TestCase
|
final class IPAnonymizerTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public static function anonymizeDataProvider(): \Generator
|
public static function anonymizeDataProvider(): \Generator
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ use App\Entity\ProjectSystem\ProjectBOMEntry;
|
||||||
use App\Helpers\Projects\ProjectBuildRequest;
|
use App\Helpers\Projects\ProjectBuildRequest;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ProjectBuildRequestTest extends TestCase
|
final class ProjectBuildRequestTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var Project */
|
/** @var Project */
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\Helpers;
|
||||||
use App\Helpers\Trees\TreeViewNode;
|
use App\Helpers\Trees\TreeViewNode;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class TreeViewNodeTest extends TestCase
|
final class TreeViewNodeTest extends TestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var TreeViewNode
|
* @var TreeViewNode
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace App\Tests\Helpers;
|
||||||
use App\Helpers\TrinaryLogicHelper;
|
use App\Helpers\TrinaryLogicHelper;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class TrinaryLogicHelperTest extends TestCase
|
final class TrinaryLogicHelperTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testNot()
|
public function testNot()
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
class AttachmentContainingDBElementRepositoryTest extends KernelTestCase
|
final class AttachmentContainingDBElementRepositoryTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private EntityManagerInterface $entityManager;
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
class DBElementRepositoryTest extends KernelTestCase
|
final class DBElementRepositoryTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private EntityManagerInterface $entityManager;
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ use Doctrine\ORM\EntityManagerInterface;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
class LogEntryRepositoryTest extends KernelTestCase
|
final class LogEntryRepositoryTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
private EntityManagerInterface $entityManager;
|
private EntityManagerInterface $entityManager;
|
||||||
|
|
@ -75,6 +75,7 @@ class LogEntryRepositoryTest extends KernelTestCase
|
||||||
//We have a edit log entry for the category with ID 1
|
//We have a edit log entry for the category with ID 1
|
||||||
$category = $this->entityManager->find(Category::class, 1);
|
$category = $this->entityManager->find(Category::class, 1);
|
||||||
$adminUser = $this->entityManager->getRepository(User::class)->findOneBy(['name' => 'admin']);
|
$adminUser = $this->entityManager->getRepository(User::class)->findOneBy(['name' => 'admin']);
|
||||||
|
$this->assertInstanceOf(Category::class, $category);
|
||||||
|
|
||||||
$user = $this->repo->getLastEditingUser($category);
|
$user = $this->repo->getLastEditingUser($category);
|
||||||
|
|
||||||
|
|
@ -83,6 +84,7 @@ class LogEntryRepositoryTest extends KernelTestCase
|
||||||
|
|
||||||
//For the category 2, the user must be null
|
//For the category 2, the user must be null
|
||||||
$category = $this->entityManager->find(Category::class, 2);
|
$category = $this->entityManager->find(Category::class, 2);
|
||||||
|
$this->assertInstanceOf(Category::class, $category);
|
||||||
$user = $this->repo->getLastEditingUser($category);
|
$user = $this->repo->getLastEditingUser($category);
|
||||||
$this->assertNull($user);
|
$this->assertNull($user);
|
||||||
}
|
}
|
||||||
|
|
@ -92,6 +94,7 @@ class LogEntryRepositoryTest extends KernelTestCase
|
||||||
//We have a edit log entry for the category with ID 1
|
//We have a edit log entry for the category with ID 1
|
||||||
$category = $this->entityManager->find(Category::class, 1);
|
$category = $this->entityManager->find(Category::class, 1);
|
||||||
$adminUser = $this->entityManager->getRepository(User::class)->findOneBy(['name' => 'admin']);
|
$adminUser = $this->entityManager->getRepository(User::class)->findOneBy(['name' => 'admin']);
|
||||||
|
$this->assertInstanceOf(Category::class, $category);
|
||||||
|
|
||||||
$user = $this->repo->getCreatingUser($category);
|
$user = $this->repo->getCreatingUser($category);
|
||||||
|
|
||||||
|
|
@ -100,6 +103,7 @@ class LogEntryRepositoryTest extends KernelTestCase
|
||||||
|
|
||||||
//For the category 2, the user must be null
|
//For the category 2, the user must be null
|
||||||
$category = $this->entityManager->find(Category::class, 2);
|
$category = $this->entityManager->find(Category::class, 2);
|
||||||
|
$this->assertInstanceOf(Category::class, $category);
|
||||||
$user = $this->repo->getCreatingUser($category);
|
$user = $this->repo->getCreatingUser($category);
|
||||||
$this->assertNull($user);
|
$this->assertNull($user);
|
||||||
}
|
}
|
||||||
|
|
@ -119,6 +123,7 @@ class LogEntryRepositoryTest extends KernelTestCase
|
||||||
public function testGetElementExistedAtTimestamp(): void
|
public function testGetElementExistedAtTimestamp(): void
|
||||||
{
|
{
|
||||||
$part = $this->entityManager->find(Part::class, 3);
|
$part = $this->entityManager->find(Part::class, 3);
|
||||||
|
$this->assertInstanceOf(Part::class, $part);
|
||||||
|
|
||||||
//Assume that the part is existing now
|
//Assume that the part is existing now
|
||||||
$this->assertTrue($this->repo->getElementExistedAtTimestamp($part, new \DateTimeImmutable()));
|
$this->assertTrue($this->repo->getElementExistedAtTimestamp($part, new \DateTimeImmutable()));
|
||||||
|
|
@ -130,6 +135,7 @@ class LogEntryRepositoryTest extends KernelTestCase
|
||||||
public function testGetElementHistory(): void
|
public function testGetElementHistory(): void
|
||||||
{
|
{
|
||||||
$category = $this->entityManager->find(Category::class, 1);
|
$category = $this->entityManager->find(Category::class, 1);
|
||||||
|
$this->assertInstanceOf(Category::class, $category);
|
||||||
|
|
||||||
$history = $this->repo->getElementHistory($category);
|
$history = $this->repo->getElementHistory($category);
|
||||||
|
|
||||||
|
|
@ -141,6 +147,7 @@ class LogEntryRepositoryTest extends KernelTestCase
|
||||||
public function testGetTimetravelDataForElement(): void
|
public function testGetTimetravelDataForElement(): void
|
||||||
{
|
{
|
||||||
$category = $this->entityManager->find(Category::class, 1);
|
$category = $this->entityManager->find(Category::class, 1);
|
||||||
|
$this->assertInstanceOf(Category::class, $category);
|
||||||
$data = $this->repo->getTimetravelDataForElement($category, new \DateTimeImmutable('2020-01-01'));
|
$data = $this->repo->getTimetravelDataForElement($category, new \DateTimeImmutable('2020-01-01'));
|
||||||
|
|
||||||
//The data must contain only ElementChangedLogEntry
|
//The data must contain only ElementChangedLogEntry
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
/**
|
/**
|
||||||
* @Group DB
|
* @Group DB
|
||||||
*/
|
*/
|
||||||
class NamedDBElementRepositoryTest extends WebTestCase
|
final class NamedDBElementRepositoryTest extends WebTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var StructuralDBElementRepository
|
* @var StructuralDBElementRepository
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,8 @@ final class PartRepositoryTest extends TestCase
|
||||||
$classMetadata = new ClassMetadata(Part::class);
|
$classMetadata = new ClassMetadata(Part::class);
|
||||||
$emMock->method('getClassMetadata')->with(Part::class)->willReturn($classMetadata);
|
$emMock->method('getClassMetadata')->with(Part::class)->willReturn($classMetadata);
|
||||||
|
|
||||||
$translatorMock = $this->createMock(TranslatorInterface::class);
|
$translatorMock = $this->createStub(TranslatorInterface::class);
|
||||||
$ipnSuggestSettings = $this->createMock(IpnSuggestSettings::class);
|
$ipnSuggestSettings = $this->createStub(IpnSuggestSettings::class);
|
||||||
|
|
||||||
$repo = $this->getMockBuilder(PartRepository::class)
|
$repo = $this->getMockBuilder(PartRepository::class)
|
||||||
->setConstructorArgs([$emMock, $translatorMock, $ipnSuggestSettings])
|
->setConstructorArgs([$emMock, $translatorMock, $ipnSuggestSettings])
|
||||||
|
|
@ -120,7 +120,7 @@ final class PartRepositoryTest extends TestCase
|
||||||
return $id;
|
return $id;
|
||||||
});
|
});
|
||||||
|
|
||||||
$ipnSuggestSettings = $this->createMock(IpnSuggestSettings::class);
|
$ipnSuggestSettings = $this->createStub(IpnSuggestSettings::class);
|
||||||
|
|
||||||
$ipnSuggestSettings->suggestPartDigits = 4;
|
$ipnSuggestSettings->suggestPartDigits = 4;
|
||||||
$ipnSuggestSettings->useDuplicateDescription = false;
|
$ipnSuggestSettings->useDuplicateDescription = false;
|
||||||
|
|
@ -204,7 +204,7 @@ final class PartRepositoryTest extends TestCase
|
||||||
return $id;
|
return $id;
|
||||||
});
|
});
|
||||||
|
|
||||||
$ipnSuggestSettings = $this->createMock(IpnSuggestSettings::class);
|
$ipnSuggestSettings = $this->createStub(IpnSuggestSettings::class);
|
||||||
|
|
||||||
$ipnSuggestSettings->suggestPartDigits = 4;
|
$ipnSuggestSettings->suggestPartDigits = 4;
|
||||||
$ipnSuggestSettings->useDuplicateDescription = false;
|
$ipnSuggestSettings->useDuplicateDescription = false;
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace App\Tests\Repository;
|
namespace App\Tests\Repository;
|
||||||
|
|
||||||
|
use App\Entity\Base\AbstractStructuralDBElement;
|
||||||
use App\Entity\Attachments\AttachmentType;
|
use App\Entity\Attachments\AttachmentType;
|
||||||
use App\Helpers\Trees\TreeViewNode;
|
use App\Helpers\Trees\TreeViewNode;
|
||||||
use App\Repository\StructuralDBElementRepository;
|
use App\Repository\StructuralDBElementRepository;
|
||||||
|
|
@ -30,7 +31,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
/**
|
/**
|
||||||
* @Group DB
|
* @Group DB
|
||||||
*/
|
*/
|
||||||
class StructuralDBElementRepositoryTest extends WebTestCase
|
final class StructuralDBElementRepositoryTest extends WebTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var StructuralDBElementRepository
|
* @var StructuralDBElementRepository
|
||||||
|
|
@ -108,6 +109,7 @@ class StructuralDBElementRepositoryTest extends WebTestCase
|
||||||
{
|
{
|
||||||
//List all nodes that are children to Node 1
|
//List all nodes that are children to Node 1
|
||||||
$node1 = $this->repo->find(1);
|
$node1 = $this->repo->find(1);
|
||||||
|
$this->assertInstanceOf(AbstractStructuralDBElement::class, $node1);
|
||||||
$nodes = $this->repo->getFlatList($node1);
|
$nodes = $this->repo->getFlatList($node1);
|
||||||
|
|
||||||
$this->assertCount(3, $nodes);
|
$this->assertCount(3, $nodes);
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Repository\UserRepository;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class UserRepositoryTest extends WebTestCase
|
final class UserRepositoryTest extends WebTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken;
|
||||||
use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
|
use Symfony\Component\Security\Core\Event\AuthenticationSuccessEvent;
|
||||||
use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
|
use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
|
||||||
|
|
||||||
class EnsureSAMLUserForSAMLLoginCheckerTest extends WebTestCase
|
final class EnsureSAMLUserForSAMLLoginCheckerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
/** @var EnsureSAMLUserForSAMLLoginChecker */
|
/** @var EnsureSAMLUserForSAMLLoginChecker */
|
||||||
protected $service;
|
protected $service;
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use App\Entity\UserSystem\User;
|
||||||
use App\Security\SamlUserFactory;
|
use App\Security\SamlUserFactory;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class SamlUserFactoryTest extends WebTestCase
|
final class SamlUserFactoryTest extends WebTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var SamlUserFactory */
|
/** @var SamlUserFactory */
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Security\UserChecker;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
|
use Symfony\Component\Security\Core\Exception\CustomUserMessageAccountStatusException;
|
||||||
|
|
||||||
class UserCheckerTest extends WebTestCase
|
final class UserCheckerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
protected $service;
|
protected $service;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
use Brick\Math\BigDecimal;
|
use Brick\Math\BigDecimal;
|
||||||
use Brick\Math\BigNumber;
|
use Brick\Math\BigNumber;
|
||||||
|
|
||||||
class BigNumberNormalizerTest extends WebTestCase
|
final class BigNumberNormalizerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
/** @var BigNumberNormalizer */
|
/** @var BigNumberNormalizer */
|
||||||
protected $service;
|
protected $service;
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\DenormalizerInterface;
|
||||||
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
|
||||||
|
|
||||||
class PartNormalizerTest extends WebTestCase
|
final class PartNormalizerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
/** @var PartNormalizer */
|
/** @var PartNormalizer */
|
||||||
protected DenormalizerInterface&NormalizerInterface $service;
|
protected DenormalizerInterface&NormalizerInterface $service;
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Entity\Parts\Category;
|
||||||
use App\Serializer\StructuralElementDenormalizer;
|
use App\Serializer\StructuralElementDenormalizer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class StructuralElementDenormalizerTest extends WebTestCase
|
final class StructuralElementDenormalizerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var StructuralElementDenormalizer */
|
/** @var StructuralElementDenormalizer */
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use App\Entity\Parts\Category;
|
||||||
use App\Serializer\StructuralElementFromNameDenormalizer;
|
use App\Serializer\StructuralElementFromNameDenormalizer;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class StructuralElementFromNameDenormalizerTest extends WebTestCase
|
final class StructuralElementFromNameDenormalizerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var StructuralElementFromNameDenormalizer */
|
/** @var StructuralElementFromNameDenormalizer */
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ use App\Serializer\StructuralElementNormalizer;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class StructuralElementNormalizerTest extends WebTestCase
|
final class StructuralElementNormalizerTest extends WebTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var StructuralElementNormalizer */
|
/** @var StructuralElementNormalizer */
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,8 @@ use App\Services\Attachments\AttachmentPathResolver;
|
||||||
use const DIRECTORY_SEPARATOR;
|
use const DIRECTORY_SEPARATOR;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
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_orig;
|
||||||
protected $projectDir;
|
protected $projectDir;
|
||||||
/**
|
/**
|
||||||
|
|
@ -46,8 +44,8 @@ class AttachmentPathResolverTest extends WebTestCase
|
||||||
|
|
||||||
$this->projectDir_orig = realpath(self::$kernel->getProjectDir());
|
$this->projectDir_orig = realpath(self::$kernel->getProjectDir());
|
||||||
$this->projectDir = str_replace('\\', '/', $this->projectDir_orig);
|
$this->projectDir = str_replace('\\', '/', $this->projectDir_orig);
|
||||||
$this->media_path = $this->projectDir.'/public/media';
|
$media_path = $this->projectDir.'/public/media';
|
||||||
$this->footprint_path = $this->projectDir.'/public/img/footprints';
|
$footprint_path = $this->projectDir.'/public/img/footprints';
|
||||||
|
|
||||||
$this->service = self::getContainer()->get(AttachmentPathResolver::class);
|
$this->service = self::getContainer()->get(AttachmentPathResolver::class);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use App\Services\Attachments\AttachmentURLGenerator;
|
use App\Services\Attachments\AttachmentURLGenerator;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class AttachmentURLGeneratorTest extends WebTestCase
|
final class AttachmentURLGeneratorTest extends WebTestCase
|
||||||
{
|
{
|
||||||
protected const PUBLIC_DIR = '/public';
|
protected const PUBLIC_DIR = '/public';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use App\Services\Attachments\BuiltinAttachmentsFinder;
|
use App\Services\Attachments\BuiltinAttachmentsFinder;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class BuiltinAttachmentsFinderTest extends WebTestCase
|
final class BuiltinAttachmentsFinderTest extends WebTestCase
|
||||||
{
|
{
|
||||||
protected static array $mock_list = [
|
protected static array $mock_list = [
|
||||||
'%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS%/123.jpg', '%FOOTPRINTS%/123.jpeg',
|
'%FOOTPRINTS%/test/test.jpg', '%FOOTPRINTS%/test/test.png', '%FOOTPRINTS%/123.jpg', '%FOOTPRINTS%/123.jpeg',
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ use PHPUnit\Framework\Attributes\DataProvider;
|
||||||
use App\Services\Attachments\FileTypeFilterTools;
|
use App\Services\Attachments\FileTypeFilterTools;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class FileTypeFilterToolsTest extends WebTestCase
|
final class FileTypeFilterToolsTest extends WebTestCase
|
||||||
{
|
{
|
||||||
protected static $service;
|
protected static $service;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ use App\Services\Formatters\AmountFormatter;
|
||||||
use App\Settings\SynonymSettings;
|
use App\Settings\SynonymSettings;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class ElementTypeNameGeneratorTest extends WebTestCase
|
final class ElementTypeNameGeneratorTest extends WebTestCase
|
||||||
{
|
{
|
||||||
protected ElementTypeNameGenerator $service;
|
protected ElementTypeNameGenerator $service;
|
||||||
private SynonymSettings $synonymSettings;
|
private SynonymSettings $synonymSettings;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||||
*
|
*
|
||||||
|
|
@ -17,7 +20,6 @@
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace App\Tests\Services;
|
namespace App\Tests\Services;
|
||||||
|
|
||||||
use App\Entity\Parameters\CategoryParameter;
|
use App\Entity\Parameters\CategoryParameter;
|
||||||
|
|
@ -26,7 +28,7 @@ use App\Exceptions\EntityNotSupportedException;
|
||||||
use App\Services\ElementTypes;
|
use App\Services\ElementTypes;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class ElementTypesTest extends TestCase
|
final class ElementTypesTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
public function testFromClass(): void
|
public function testFromClass(): void
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
|
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
|
||||||
|
|
||||||
class EntityMergerHelperTraitTest extends KernelTestCase
|
final class EntityMergerHelperTraitTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
use EntityMergerHelperTrait;
|
use EntityMergerHelperTrait;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ use App\Services\EntityMergers\Mergers\PartMerger;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||||
|
|
||||||
class PartMergerTest extends KernelTestCase
|
final class PartMergerTest extends KernelTestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
/** @var PartMerger|null */
|
/** @var PartMerger|null */
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ use App\Services\Formatters\AmountFormatter;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||||
|
|
||||||
class AmountFormatterTest extends WebTestCase
|
final class AmountFormatterTest extends WebTestCase
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var AmountFormatter
|
* @var AmountFormatter
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue