@@ 283-298 (lines=16) @@ | ||
280 | /** |
|
281 | * Test serialization with host in url for original |
|
282 | */ |
|
283 | public function testSerializationWithHostForOriginal(): void |
|
284 | { |
|
285 | $userPictures = new UserPictures(); |
|
286 | $this->generateCacheManager(); |
|
287 | $this->generateRequestContext(true, true); |
|
288 | $data = $this->serializeObject($userPictures, [ |
|
289 | 'includeHost' => false, |
|
290 | 'vichUploaderSerialize' => true, |
|
291 | 'includeOriginal' => true, |
|
292 | 'includeHostForOriginal' => true, |
|
293 | ]); |
|
294 | ||
295 | static::assertEquals('/uploads/photo.jpg', $data['photo']); |
|
296 | static::assertFalse((bool) \mb_strpos($data['cover']['original'], 'https://example.com:8800')); |
|
297 | static::assertEquals('https://example.com:8800/uploads/photo.jpg', $data['photoThumb']['original']); |
|
298 | } |
|
299 | ||
300 | /** |
|
301 | * Test serialization with host in url and host in url for original |
|
@@ 303-318 (lines=16) @@ | ||
300 | /** |
|
301 | * Test serialization with host in url and host in url for original |
|
302 | */ |
|
303 | public function testSerializationWithHostAndHostForOriginal(): void |
|
304 | { |
|
305 | $userPictures = new UserPictures(); |
|
306 | $this->generateCacheManager(); |
|
307 | $this->generateRequestContext(true, true); |
|
308 | $data = $this->serializeObject($userPictures, [ |
|
309 | 'includeHost' => true, |
|
310 | 'vichUploaderSerialize' => true, |
|
311 | 'includeOriginal' => true, |
|
312 | 'includeHostForOriginal' => true, |
|
313 | ]); |
|
314 | ||
315 | static::assertEquals('https://example.com:8800/uploads/photo.jpg', $data['photo']); |
|
316 | static::assertFalse((bool) \mb_strpos($data['cover']['original'], 'https://example.com:8800')); |
|
317 | static::assertEquals('https://example.com:8800/uploads/photo.jpg', $data['photoThumb']['original']); |
|
318 | } |
|
319 | ||
320 | /** |
|
321 | * Test serialization with host in url and host in url for original and non-stored (resolve path) images |
|
@@ 366-380 (lines=15) @@ | ||
363 | /** |
|
364 | * Test serialization with no host in url and no host in url for original and ONE non-stored (resolve path) image |
|
365 | */ |
|
366 | public function testSerializationWithNoHostAndNoHostForOriginalAndOneNonStoredImage(): void |
|
367 | { |
|
368 | $userPictures = new UserPictures(); |
|
369 | $this->generateCacheManager('https://example.com:8800/', false); |
|
370 | $this->generateRequestContext(true, true); |
|
371 | $data = $this->serializeObject($userPictures, [ |
|
372 | 'includeHost' => false, |
|
373 | 'vichUploaderSerialize' => true, |
|
374 | 'includeOriginal' => true, |
|
375 | 'includeHostForOriginal' => false, |
|
376 | ]); |
|
377 | ||
378 | static::assertEquals('/uploads/photo.jpg', $data['photoThumb']['original']); |
|
379 | static::assertEquals('/a/path/to/an/resolve/image3.png', $data['photoThumb']['thumb_filter']); |
|
380 | } |
|
381 | ||
382 | /** |
|
383 | * Test serialization without host in url and array of filters |