@@ -245,6 +245,10 @@ public function testAsNonAdminUserICannotCreateABook(int $expectedCode, string $
245
245
'book ' => 'https://openlibrary.org/books/OL28346544M.json ' ,
246
246
'condition ' => BookCondition::NewCondition->value ,
247
247
],
248
+ 'headers ' => [
249
+ 'Content-Type ' => 'application/ld+json ' ,
250
+ 'Accept ' => 'application/ld+json ' ,
251
+ ],
248
252
]);
249
253
250
254
self ::assertResponseStatusCodeSame ($ expectedCode );
@@ -269,6 +273,10 @@ public function testAsAdminUserICannotCreateABookWithInvalidData(array $data, in
269
273
$ this ->client ->request ('POST ' , '/admin/books ' , [
270
274
'auth_bearer ' => $ token ,
271
275
'json ' => $ data ,
276
+ 'headers ' => [
277
+ 'Content-Type ' => 'application/ld+json ' ,
278
+ 'Accept ' => 'application/ld+json ' ,
279
+ ],
272
280
]);
273
281
274
282
self ::assertResponseStatusCodeSame ($ statusCode );
@@ -389,6 +397,10 @@ public function testAsAdminUserICanCreateABook(): void
389
397
'book ' => 'https://openlibrary.org/books/OL28346544M.json ' ,
390
398
'condition ' => BookCondition::NewCondition->value ,
391
399
],
400
+ 'headers ' => [
401
+ 'Content-Type ' => 'application/ld+json ' ,
402
+ 'Accept ' => 'application/ld+json ' ,
403
+ ],
392
404
]);
393
405
394
406
self ::assertResponseStatusCodeSame (Response::HTTP_CREATED );
@@ -448,6 +460,10 @@ public function testAsNonAdminUserICannotUpdateBook(int $expectedCode, string $h
448
460
'book ' => 'https://openlibrary.org/books/OL28346544M.json ' ,
449
461
'condition ' => BookCondition::NewCondition->value ,
450
462
],
463
+ 'headers ' => [
464
+ 'Content-Type ' => 'application/ld+json ' ,
465
+ 'Accept ' => 'application/ld+json ' ,
466
+ ],
451
467
]);
452
468
453
469
self ::assertResponseStatusCodeSame ($ expectedCode );
@@ -473,6 +489,10 @@ public function testAsAdminUserICannotUpdateAnInvalidBook(): void
473
489
'json ' => [
474
490
'condition ' => BookCondition::DamagedCondition->value ,
475
491
],
492
+ 'headers ' => [
493
+ 'Content-Type ' => 'application/ld+json ' ,
494
+ 'Accept ' => 'application/ld+json ' ,
495
+ ],
476
496
]);
477
497
478
498
self ::assertResponseStatusCodeSame (Response::HTTP_NOT_FOUND );
@@ -492,6 +512,10 @@ public function testAsAdminUserICannotUpdateABookWithInvalidData(array $data, in
492
512
$ this ->client ->request ('PUT ' , '/admin/books/ ' .$ book ->getId (), [
493
513
'auth_bearer ' => $ token ,
494
514
'json ' => $ data ,
515
+ 'headers ' => [
516
+ 'Content-Type ' => 'application/ld+json ' ,
517
+ 'Accept ' => 'application/ld+json ' ,
518
+ ],
495
519
]);
496
520
497
521
self ::assertResponseStatusCodeSame ($ statusCode );
@@ -518,12 +542,15 @@ public function testAsAdminUserICanUpdateABook(): void
518
542
$ this ->client ->request ('PUT ' , '/admin/books/ ' .$ book ->getId (), [
519
543
'auth_bearer ' => $ token ,
520
544
'json ' => [
521
- /* @see https://github.com/api-platform/core/blob/main/src/Serializer/ItemNormalizer.php */
522
- 'id ' => '/books/ ' .$ book ->getId (),
545
+ '@id ' => '/books/ ' .$ book ->getId (),
523
546
// Must set all data because of standard PUT
524
547
'book ' => 'https://openlibrary.org/books/OL28346544M.json ' ,
525
548
'condition ' => BookCondition::DamagedCondition->value ,
526
549
],
550
+ 'headers ' => [
551
+ 'Content-Type ' => 'application/ld+json ' ,
552
+ 'Accept ' => 'application/ld+json ' ,
553
+ ],
527
554
]);
528
555
529
556
self ::assertResponseStatusCodeSame (Response::HTTP_OK );
0 commit comments