Use enums for LabelOptions

This commit is contained in:
Jan Böhmer 2023-06-12 23:39:30 +02:00
parent 485b35fbd4
commit 71cd4057a7
23 changed files with 329 additions and 157 deletions

View file

@ -42,6 +42,8 @@ declare(strict_types=1);
namespace App\Tests\Services\LabelSystem;
use App\Entity\LabelSystem\LabelOptions;
use App\Entity\LabelSystem\LabelProcessMode;
use App\Entity\LabelSystem\LabelSupportedElement;
use App\Entity\Parts\Part;
use App\Entity\Parts\PartLot;
use App\Entity\Parts\Storelocation;
@ -104,9 +106,9 @@ class SandboxedTwigProviderTest extends WebTestCase
public function testTwigFeatures(string $twig): void
{
$options = new LabelOptions();
$options->setSupportedElement('part');
$options->setSupportedElement(LabelSupportedElement::PART);
$options->setLines($twig);
$options->setLinesMode('twig');
$options->setProcessMode(LabelProcessMode::TWIG);
$twig = $this->service->getTwig($options);
$str = $twig->render('lines', [
@ -126,9 +128,9 @@ class SandboxedTwigProviderTest extends WebTestCase
$this->expectException(SecurityError::class);
$options = new LabelOptions();
$options->setSupportedElement('part');
$options->setSupportedElement(LabelSupportedElement::PART);
$options->setLines($twig);
$options->setLinesMode('twig');
$options->setProcessMode(LabelProcessMode::TWIG);
$twig = $this->service->getTwig($options);
$str = $twig->render('lines', [