Fixed test failure, caused by validation on user element

This commit is contained in:
Jan Böhmer 2023-06-18 22:11:58 +02:00
parent cce3e1cfb8
commit bb510a9240

View file

@ -22,6 +22,7 @@ declare(strict_types=1);
namespace App\Tests\Services\ImportExportSystem; namespace App\Tests\Services\ImportExportSystem;
use App\Entity\Attachments\AttachmentContainingDBElement;
use App\Entity\Attachments\AttachmentType; use App\Entity\Attachments\AttachmentType;
use App\Entity\Parts\Category; use App\Entity\Parts\Category;
use App\Entity\Parts\Part; use App\Entity\Parts\Part;
@ -81,8 +82,12 @@ Test1
Test2 Test2
EOT; EOT;
//Define a new anonymous class, which is not structural. We can not use User here, because it does some validation
$anonymous_object = new class extends AttachmentContainingDBElement {};
$anonymous_class = get_class($anonymous_object);
$errors = []; $errors = [];
$results = $this->service->massCreation($input, User::class, null, $errors); $results = $this->service->massCreation($input, $anonymous_class, null, $errors);
//Import must not fail, even with non-structural classes //Import must not fail, even with non-structural classes
$this->assertCount(3, $results); $this->assertCount(3, $results);