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 5
5
namespace PhpList \RestBundle \Common \EventListener ;
6
6
7
7
use Exception ;
8
+ use PhpList \Core \Domain \Identity \Exception \AdminAttributeCreationException ;
8
9
use PhpList \Core \Domain \Subscription \Exception \SubscriptionCreationException ;
9
10
use Symfony \Component \HttpFoundation \JsonResponse ;
10
11
use Symfony \Component \HttpKernel \Event \ExceptionEvent ;
@@ -35,6 +36,11 @@ public function onKernelException(ExceptionEvent $event): void
35
36
'message ' => $ exception ->getMessage (),
36
37
], $ exception ->getStatusCode ());
37
38
$ event ->setResponse ($ response );
39
+ } elseif ($ exception instanceof AdminAttributeCreationException) {
40
+ $ response = new JsonResponse ([
41
+ 'message ' => $ exception ->getMessage (),
42
+ ], $ exception ->getStatusCode ());
43
+ $ event ->setResponse ($ response );
38
44
} elseif ($ exception instanceof ValidatorException) {
39
45
$ response = new JsonResponse ([
40
46
'message ' => $ exception ->getMessage (),
Original file line number Diff line number Diff line change @@ -81,10 +81,10 @@ public function testGetViewOpensStatisticsReturnsViewData(): void
81
81
$ response = $ this ->getDecodedJsonResponseContent ();
82
82
83
83
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 ' ] );
88
88
}
89
89
90
90
public function testGetTopDomainsWithoutSessionKeyReturnsForbidden (): void
You can’t perform that action at this time.
0 commit comments