From 713b8357cddf5b0cc2f03707cff397f18956d5dc Mon Sep 17 00:00:00 2001 From: nobohan Date: Thu, 6 Oct 2022 15:26:44 +0200 Subject: [PATCH 1/3] [person]: add new test for social action normalizer --- .../Normalizer/SocialActionNormalizerTest.php | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/SocialActionNormalizerTest.php diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/SocialActionNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/SocialActionNormalizerTest.php new file mode 100644 index 000000000..9d43eaaf8 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/SocialActionNormalizerTest.php @@ -0,0 +1,48 @@ +normalizer = self::$container->get(NormalizerInterface::class); + } + + public function testNormalization() + { + $sa = new SocialAction(); + + $normalized = $this->normalizer->normalize( + $sa, + 'json', + ['groups' => ['read']] + ); + + $this->assertIsArray($normalized); + $this->assertArrayHasKey('type', $normalized); + $this->assertEquals('social_work_social_action', $normalized['type']); + } +} From 4ca5fb98691deb2abe77a714b6cd5904b4fb7e2b Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 7 Oct 2022 10:23:41 +0200 Subject: [PATCH 2/3] [person]: add origin and social issue normalizer tests + typo --- ...AccompanyingPeriodOriginNormalizerTest.php | 48 +++++++++++++++++++ ...mpanyingPeriodWorkDocGenNormalizerTest.php | 2 +- .../Normalizer/SocialIssueNormalizerTest.php | 48 +++++++++++++++++++ 3 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodOriginNormalizerTest.php create mode 100644 src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/SocialIssueNormalizerTest.php diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodOriginNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodOriginNormalizerTest.php new file mode 100644 index 000000000..c725599b7 --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodOriginNormalizerTest.php @@ -0,0 +1,48 @@ +normalizer = self::$container->get(NormalizerInterface::class); + } + + public function testNormalization() + { + $o = new Origin(); + + $normalized = $this->normalizer->normalize( + $o, + 'json', + ['groups' => ['read']] + ); + + $this->assertIsArray($normalized); + $this->assertArrayHasKey('type', $normalized); + $this->assertEquals('origin', $normalized['type']); + } +} diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkDocGenNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkDocGenNormalizerTest.php index 71d0f6f31..50e0803e8 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkDocGenNormalizerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodWorkDocGenNormalizerTest.php @@ -61,7 +61,7 @@ final class AccompanyingPeriodWorkDocGenNormalizerTest extends KernelTestCase } } - public function testNormlalize() + public function testNormalize() { $work = new AccompanyingPeriodWork(); $work diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/SocialIssueNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/SocialIssueNormalizerTest.php new file mode 100644 index 000000000..3e56cf74b --- /dev/null +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/SocialIssueNormalizerTest.php @@ -0,0 +1,48 @@ +normalizer = self::$container->get(NormalizerInterface::class); + } + + public function testNormalization() + { + $si = new SocialIssue(); + + $normalized = $this->normalizer->normalize( + $si, + 'json', + ['groups' => ['read']] + ); + + $this->assertIsArray($normalized); + $this->assertArrayHasKey('type', $normalized); + $this->assertEquals('social_issue', $normalized['type']); + } +} From 80052cc6c81f0a9e9fa840d8335d6183d645b2be Mon Sep 17 00:00:00 2001 From: nobohan Date: Fri, 7 Oct 2022 10:47:55 +0200 Subject: [PATCH 3/3] [person] normalizer tests: php stan --- .../Normalizer/AccompanyingPeriodOriginNormalizerTest.php | 2 -- .../Tests/Serializer/Normalizer/SocialActionNormalizerTest.php | 2 -- .../Tests/Serializer/Normalizer/SocialIssueNormalizerTest.php | 2 -- 3 files changed, 6 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodOriginNormalizerTest.php b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodOriginNormalizerTest.php index c725599b7..cba5ed875 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodOriginNormalizerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Serializer/Normalizer/AccompanyingPeriodOriginNormalizerTest.php @@ -1,6 +1,5 @@