From bb510a92403416bfff04aadc9013ffd76b3ccf4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 18 Jun 2023 22:11:58 +0200 Subject: [PATCH] Fixed test failure, caused by validation on user element --- tests/Services/ImportExportSystem/EntityImporterTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/Services/ImportExportSystem/EntityImporterTest.php b/tests/Services/ImportExportSystem/EntityImporterTest.php index d6eeeb09..b7dd26d0 100644 --- a/tests/Services/ImportExportSystem/EntityImporterTest.php +++ b/tests/Services/ImportExportSystem/EntityImporterTest.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace App\Tests\Services\ImportExportSystem; +use App\Entity\Attachments\AttachmentContainingDBElement; use App\Entity\Attachments\AttachmentType; use App\Entity\Parts\Category; use App\Entity\Parts\Part; @@ -81,8 +82,12 @@ Test1 Test2 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 = []; - $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 $this->assertCount(3, $results);