mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-27 04:08:57 +02:00
Improved code style of tests
This commit is contained in:
parent
5629215ce4
commit
684334ba22
73 changed files with 196 additions and 38 deletions
|
@ -48,6 +48,9 @@ use App\Services\LabelSystem\Barcodes\BarcodeContentGenerator;
|
|||
use Com\Tecnick\Barcode\Barcode;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\BarcodeGeneratorTest
|
||||
*/
|
||||
final class BarcodeGenerator
|
||||
{
|
||||
public function __construct(private readonly BarcodeContentGenerator $barcodeContentGenerator)
|
||||
|
|
|
@ -48,6 +48,9 @@ use App\Entity\Parts\Storelocation;
|
|||
use InvalidArgumentException;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeContentGeneratorTest
|
||||
*/
|
||||
final class BarcodeContentGenerator
|
||||
{
|
||||
public const PREFIX_MAP = [
|
||||
|
|
|
@ -43,6 +43,9 @@ namespace App\Services\LabelSystem\Barcodes;
|
|||
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeNormalizerTest
|
||||
*/
|
||||
final class BarcodeNormalizer
|
||||
{
|
||||
private const PREFIX_TYPE_MAP = [
|
||||
|
|
|
@ -47,6 +47,9 @@ use Doctrine\ORM\EntityNotFoundException;
|
|||
use InvalidArgumentException;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\Barcodes\BarcodeRedirectorTest
|
||||
*/
|
||||
final class BarcodeRedirector
|
||||
{
|
||||
public function __construct(private readonly UrlGeneratorInterface $urlGenerator, private readonly EntityManagerInterface $em)
|
||||
|
|
|
@ -48,6 +48,9 @@ use App\Entity\Parts\Storelocation;
|
|||
use Dompdf\Dompdf;
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\LabelGeneratorTest
|
||||
*/
|
||||
final class LabelGenerator
|
||||
{
|
||||
public const CLASS_SUPPORT_MAPPING = [
|
||||
|
|
|
@ -46,6 +46,7 @@ use App\Services\LabelSystem\PlaceholderProviders\PlaceholderProviderInterface;
|
|||
/**
|
||||
* This service replaces the Placeholders of the user provided lines with the proper informations.
|
||||
* It uses the PlaceholderProviders provided by PlaceholderProviderInterface classes.
|
||||
* @see \App\Tests\Services\LabelSystem\LabelTextReplacerTest
|
||||
*/
|
||||
final class LabelTextReplacer
|
||||
{
|
||||
|
|
|
@ -50,6 +50,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|||
|
||||
/**
|
||||
* Provides Placeholders for infos about global infos like Installation name or datetimes.
|
||||
* @see \App\Tests\Services\LabelSystem\PlaceholderProviders\GlobalProvidersTest
|
||||
*/
|
||||
final class GlobalProviders implements PlaceholderProviderInterface
|
||||
{
|
||||
|
|
|
@ -43,6 +43,9 @@ namespace App\Services\LabelSystem\PlaceholderProviders;
|
|||
|
||||
use App\Entity\Contracts\NamedElementInterface;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\PlaceholderProviders\NamedElementProviderTest
|
||||
*/
|
||||
final class NamedElementProvider implements PlaceholderProviderInterface
|
||||
{
|
||||
public function replace(string $placeholder, object $label_target, array $options = []): ?string
|
||||
|
|
|
@ -49,6 +49,9 @@ use App\Services\LabelSystem\LabelTextReplacer;
|
|||
use IntlDateFormatter;
|
||||
use Locale;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\PlaceholderProviders\PartLotProviderTest
|
||||
*/
|
||||
final class PartLotProvider implements PlaceholderProviderInterface
|
||||
{
|
||||
public function __construct(private readonly LabelTextReplacer $labelTextReplacer, private readonly AmountFormatter $amountFormatter)
|
||||
|
|
|
@ -49,6 +49,9 @@ use App\Services\Formatters\SIFormatter;
|
|||
use Parsedown;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\PlaceholderProviders\PartProviderTest
|
||||
*/
|
||||
final class PartProvider implements PlaceholderProviderInterface
|
||||
{
|
||||
public function __construct(private readonly SIFormatter $siFormatter, private readonly TranslatorInterface $translator)
|
||||
|
|
|
@ -46,6 +46,9 @@ use DateTime;
|
|||
use IntlDateFormatter;
|
||||
use Locale;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\PlaceholderProviders\TimestampableElementProviderTest
|
||||
*/
|
||||
final class TimestampableElementProvider implements PlaceholderProviderInterface
|
||||
{
|
||||
public function replace(string $placeholder, object $label_target, array $options = []): ?string
|
||||
|
|
|
@ -68,6 +68,9 @@ use Twig\Extra\Intl\IntlExtension;
|
|||
use Twig\Loader\ArrayLoader;
|
||||
use Twig\Sandbox\SecurityPolicyInterface;
|
||||
|
||||
/**
|
||||
* @see \App\Tests\Services\LabelSystem\SandboxedTwigProviderTest
|
||||
*/
|
||||
final class SandboxedTwigProvider
|
||||
{
|
||||
private const ALLOWED_TAGS = ['apply', 'autoescape', 'do', 'for', 'if', 'set', 'verbatim', 'with'];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue