mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Fixed test failure, caused by validation on user element
This commit is contained in:
parent
cce3e1cfb8
commit
bb510a9240
1 changed files with 6 additions and 1 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue