|
@@ 255-270 (lines=16) @@
|
| 252 |
|
/** |
| 253 |
|
* Test serialization with host in url for original |
| 254 |
|
*/ |
| 255 |
|
public function testSerializationWithHostForOriginal() |
| 256 |
|
{ |
| 257 |
|
$userPictures = new UserPictures(); |
| 258 |
|
$this->generateCacheManager(); |
| 259 |
|
$this->generateRequestContext(true, true); |
| 260 |
|
$data = $this->serializeObject($userPictures, [ |
| 261 |
|
'includeHost' => false, |
| 262 |
|
'vichUploaderSerialize' => true, |
| 263 |
|
'includeOriginal' => true, |
| 264 |
|
'includeHostForOriginal' => true, |
| 265 |
|
]); |
| 266 |
|
|
| 267 |
|
static::assertEquals('/uploads/photo.jpg', $data['photo']); |
| 268 |
|
static::assertFalse(strpos($data['cover']['original'], 'https://example.com:8800')); |
| 269 |
|
static::assertEquals('https://example.com:8800/uploads/photo.jpg', $data['photoThumb']['original']); |
| 270 |
|
} |
| 271 |
|
|
| 272 |
|
/** |
| 273 |
|
* Test serialization with host in url and host in url for original |
|
@@ 275-290 (lines=16) @@
|
| 272 |
|
/** |
| 273 |
|
* Test serialization with host in url and host in url for original |
| 274 |
|
*/ |
| 275 |
|
public function testSerializationWithHostAndHostForOriginal() |
| 276 |
|
{ |
| 277 |
|
$userPictures = new UserPictures(); |
| 278 |
|
$this->generateCacheManager(); |
| 279 |
|
$this->generateRequestContext(true, true); |
| 280 |
|
$data = $this->serializeObject($userPictures, [ |
| 281 |
|
'includeHost' => true, |
| 282 |
|
'vichUploaderSerialize' => true, |
| 283 |
|
'includeOriginal' => true, |
| 284 |
|
'includeHostForOriginal' => true, |
| 285 |
|
]); |
| 286 |
|
|
| 287 |
|
static::assertEquals('https://example.com:8800/uploads/photo.jpg', $data['photo']); |
| 288 |
|
static::assertFalse(strpos($data['cover']['original'], 'https://example.com:8800')); |
| 289 |
|
static::assertEquals('https://example.com:8800/uploads/photo.jpg', $data['photoThumb']['original']); |
| 290 |
|
} |
| 291 |
|
|
| 292 |
|
/** |
| 293 |
|
* Test serialization with host in url and host in url for original and non-stored (resolve path) images |
|
@@ 338-352 (lines=15) @@
|
| 335 |
|
/** |
| 336 |
|
* Test serialization with no host in url and no host in url for original and ONE non-stored (resolve path) image |
| 337 |
|
*/ |
| 338 |
|
public function testSerializationWithNoHostAndNoHostForOriginalAndOneNonStoredImage() |
| 339 |
|
{ |
| 340 |
|
$userPictures = new UserPictures(); |
| 341 |
|
$this->generateCacheManager('https://example.com:8800/', false); |
| 342 |
|
$this->generateRequestContext(true, true); |
| 343 |
|
$data = $this->serializeObject($userPictures, [ |
| 344 |
|
'includeHost' => false, |
| 345 |
|
'vichUploaderSerialize' => true, |
| 346 |
|
'includeOriginal' => true, |
| 347 |
|
'includeHostForOriginal' => false, |
| 348 |
|
]); |
| 349 |
|
|
| 350 |
|
static::assertEquals('/uploads/photo.jpg', $data['photoThumb']['original']); |
| 351 |
|
static::assertEquals('/a/path/to/an/resolve/image3.png', $data['photoThumb']['thumb_filter']); |
| 352 |
|
} |
| 353 |
|
|
| 354 |
|
/** |
| 355 |
|
* Test serialization without host in url and array of filters |