finalize normalization on ressources

This commit is contained in:
2022-03-21 17:33:01 +01:00
parent b4add2de95
commit 169d4dc41c
6 changed files with 40 additions and 22 deletions

View File

@@ -61,7 +61,7 @@ class CommentEmbeddable
public function isEmpty()
{
return empty($this->getComment());
return null === $this->getComment() || '' === $this->getComment();
}
public function setComment(?string $comment)

View File

@@ -39,7 +39,7 @@ class CommentEmbeddableDocGenNormalizer implements ContextAwareNormalizerInterfa
*/
public function normalize($object, ?string $format = null, array $context = []): array
{
if (null === $object or (null === $object->getComment() and null === $object->getUserId() and null === $object->getDate())) {
if (null === $object || ($object->isEmpty())) {
return [
'comment' => '',
'isNull' => true,

View File

@@ -101,7 +101,9 @@ final class UserControllerTest extends WebTestCase
// Check data in the show view
$this->assertStringContainsString(
"Test_user", $crawler->text(), "page contains the name of the user"
'Test_user',
$crawler->text(),
'page contains the name of the user'
);
//test the auth of the new client