File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
tests/Integration/Statistics/Controller Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change 55namespace PhpList \RestBundle \Common \EventListener ;
66
77use Exception ;
8+ use PhpList \Core \Domain \Identity \Exception \AdminAttributeCreationException ;
89use PhpList \Core \Domain \Subscription \Exception \SubscriptionCreationException ;
910use Symfony \Component \HttpFoundation \JsonResponse ;
1011use Symfony \Component \HttpKernel \Event \ExceptionEvent ;
@@ -35,6 +36,11 @@ public function onKernelException(ExceptionEvent $event): void
3536 'message ' => $ exception ->getMessage (),
3637 ], $ exception ->getStatusCode ());
3738 $ event ->setResponse ($ response );
39+ } elseif ($ exception instanceof AdminAttributeCreationException) {
40+ $ response = new JsonResponse ([
41+ 'message ' => $ exception ->getMessage (),
42+ ], $ exception ->getStatusCode ());
43+ $ event ->setResponse ($ response );
3844 } elseif ($ exception instanceof ValidatorException) {
3945 $ response = new JsonResponse ([
4046 'message ' => $ exception ->getMessage (),
Original file line number Diff line number Diff line change @@ -81,10 +81,10 @@ public function testGetViewOpensStatisticsReturnsViewData(): void
8181 $ response = $ this ->getDecodedJsonResponseContent ();
8282
8383 self ::assertIsArray ($ response );
84- self ::assertArrayHasKey ('campaigns ' , $ response );
85- self ::assertArrayHasKey ('total ' , $ response );
86- self ::assertArrayHasKey ( ' hasMore ' , $ response );
87- self ::assertArrayHasKey ( ' lastId ' , $ response );
84+ self ::assertArrayHasKey ('items ' , $ response );
85+ self ::assertArrayHasKey ('pagination ' , $ response );
86+ self ::assertIsArray ( $ response[ ' items ' ] );
87+ self ::assertIsArray ( $ response[ ' pagination ' ] );
8888 }
8989
9090 public function testGetTopDomainsWithoutSessionKeyReturnsForbidden (): void
You can’t perform that action at this time.
0 commit comments