File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
src/ApiPlatform/Resources/Attribute
tests/Integration/ApiPlatform Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,7 @@ class Attribute
9292 public int $ attributeGroupId ;
9393
9494 #[LocalizedValue]
95+ #[Assert \NotBlank(groups: ['Create ' ])]
9596 #[DefaultLanguage(groups: ['Create ' ], fieldName: 'names ' )]
9697 #[DefaultLanguage(groups: ['Update ' ], fieldName: 'names ' , allowNull: true )]
9798 #[Assert \All(constraints: [
@@ -107,16 +108,14 @@ class Attribute
107108 #[Assert \NotBlank(allowNull: true )]
108109 public array $ shopIds ;
109110
110- public int $ position ;
111-
112111 public const QUERY_MAPPING = [
113112 '[localizedNames] ' => '[names] ' ,
114113 '[name] ' => '[names] ' ,
115114 '[associatedShopIds] ' => '[shopIds] ' ,
116115 ];
117116
118117 public const CREATE_COMMAND_MAPPING = [
119- '[names] ' => '[localizedValue ] ' ,
118+ '[names] ' => '[localizedNames ] ' ,
120119 '[shopIds] ' => '[associatedShopIds] ' ,
121120 ];
122121
Original file line number Diff line number Diff line change @@ -131,7 +131,13 @@ public function testPartialUpdateContact(int $contactId): int
131131 $ updatedContact = $ this ->partialUpdateItem ('/contacts/ ' . $ contactId , $ patchData , ['contact_write ' ]);
132132 $ this ->assertSame ($ patchData ['names ' ], $ updatedContact ['names ' ]);
133133 $ this ->assertSame ($ patchData ['email ' ], $ updatedContact ['email ' ]);
134- $ this ->assertSame ((bool ) $ patchData ['messagesSavingEnabled ' ], (bool ) $ updatedContact ['messagesSavingEnabled ' ]);
134+
135+ // We check that when we GET the item it is updated as expected
136+ $ contact = $ this ->getItem ('/contacts/ ' . $ contactId , ['contact_read ' ]);
137+ $ this ->assertSame ($ patchData ['names ' ], $ contact ['names ' ]);
138+ $ this ->assertSame ($ patchData ['email ' ], $ contact ['email ' ]);
139+ $ this ->assertArrayHasKey ('messagesSavingEnabled ' , $ contact );
140+ $ this ->assertSame ((bool ) $ patchData ['messagesSavingEnabled ' ], (bool ) $ contact ['messagesSavingEnabled ' ]);
135141
136142 return $ contactId ;
137143 }
You can’t perform that action at this time.
0 commit comments