@@ 170-184 (lines=15) @@ | ||
167 | /** |
|
168 | * Test serialization with origin normalizer |
|
169 | */ |
|
170 | public function testSerializationWithOriginNormalizer(): void |
|
171 | { |
|
172 | $userPictures = new UserPictures(); |
|
173 | $this->generateCacheManager(); |
|
174 | $this->generateRequestContext(); |
|
175 | $data = $this->serializeObject($userPictures, [ |
|
176 | 'includeHost' => false, |
|
177 | 'vichUploaderSerialize' => true, |
|
178 | 'includeOriginal' => true, |
|
179 | 'originUrlNormalizer' => OriginUrlNormalizer::class, |
|
180 | ]); |
|
181 | ||
182 | static::assertEquals('/uploads/newPhoto.jpg', $data['photoThumb']['original']); |
|
183 | static::assertEquals('/uploads/newPhoto.jpg', $data['photo']); |
|
184 | } |
|
185 | ||
186 | /** |
|
187 | * Test serialization with filtered normalizer |
|
@@ 189-203 (lines=15) @@ | ||
186 | /** |
|
187 | * Test serialization with filtered normalizer |
|
188 | */ |
|
189 | public function testSerializationWithFilteredNormalizer(): void |
|
190 | { |
|
191 | $userPictures = new UserPictures(); |
|
192 | $this->generateCacheManager(); |
|
193 | $this->generateRequestContext(); |
|
194 | $data = $this->serializeObject($userPictures, [ |
|
195 | 'includeHost' => true, |
|
196 | 'vichUploaderSerialize' => true, |
|
197 | 'includeOriginal' => true, |
|
198 | 'filteredUrlNormalizer' => FilteredUrlNormalizer::class, |
|
199 | ]); |
|
200 | ||
201 | static::assertEquals('http://img.example.com:8800/a/path/to/an/image3.png', $data['photoThumb']['thumb_filter']); |
|
202 | static::assertEquals('http://img.example.com:8800/a/path/to/an/image1.png', $data['cover']['big']); |
|
203 | } |
|
204 | ||
205 | /** |
|
206 | * Test serialization with event subscriber |
|
@@ 265-278 (lines=14) @@ | ||
262 | /** |
|
263 | * Test serialization without host in url and one filter |
|
264 | */ |
|
265 | public function testSerializationWithoutHost(): void |
|
266 | { |
|
267 | $userPictures = new User(); |
|
268 | $this->generateCacheManager('/'); |
|
269 | $this->generateRequestContext(true, true); |
|
270 | $data = $this->serializeObject($userPictures, [ |
|
271 | 'includeHost' => false, |
|
272 | 'vichUploaderSerialize' => true, |
|
273 | 'includeOriginal' => false, |
|
274 | ]); |
|
275 | ||
276 | static::assertEquals('/a/path/to/an/image1.png', $data['cover']); |
|
277 | static::assertEquals('/a/path/to/an/image2.png', $data['photo']); |
|
278 | } |
|
279 | ||
280 | /** |
|
281 | * Test serialization with host in url for original |