Add new file for StoredObjectType tests and update class definitions

This commit adds a new file, StoredObjectTypeTest.php, to ChillDocStoreBundle Tests. It contains unit tests for the StoredObjectType class. Changes are also made in StoredObjectNormalizer and StoredObjectDataMapper classes, making JWTDavTokenProviderInterface and UrlGeneratorInterface as readonly in StoredObjectNormalizer and removing unnecessary EntityManagerInterface and debug commands on StoredObjectDataMapper. These changes improve test coverage and optimize the code for better performance.
This commit is contained in:
2024-05-28 12:08:02 +02:00
parent 775535e683
commit 111a21fcec
3 changed files with 110 additions and 12 deletions

View File

@@ -12,16 +12,14 @@ declare(strict_types=1);
namespace Chill\DocStoreBundle\Form\DataMapper;
use Chill\DocStoreBundle\Entity\StoredObject;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Form\DataMapperInterface;
use Symfony\Component\Form\Exception;
use Symfony\Component\Form\FormInterface;
class StoredObjectDataMapper implements DataMapperInterface
{
public function __construct(
private EntityManagerInterface $entityManager,
) {
public function __construct()
{
}
/**
@@ -55,10 +53,7 @@ class StoredObjectDataMapper implements DataMapperInterface
throw new Exception\UnexpectedTypeException($viewData, StoredObject::class);
}
dump($forms['stored_object']->getData(), $viewData);
if (null === $forms['stored_object']->getData()) {
return;
}
@@ -76,7 +71,5 @@ class StoredObjectDataMapper implements DataMapperInterface
if (array_key_exists('title', $forms)) {
$viewData->setTitle($forms['title']->getData());
}
dump($viewData);
}
}