|
@@ 234-249 (lines=16) @@
|
| 231 |
|
/** |
| 232 |
|
* Test serialization with host in url for original |
| 233 |
|
*/ |
| 234 |
|
public function testSerializationWithHostForOriginal() |
| 235 |
|
{ |
| 236 |
|
$userPictures = new UserPictures(); |
| 237 |
|
$this->generateCacheManager(); |
| 238 |
|
$this->generateRequestContext(true, true); |
| 239 |
|
$data = $this->serializeObject($userPictures, [ |
| 240 |
|
'includeHost' => false, |
| 241 |
|
'vichUploaderSerialize' => true, |
| 242 |
|
'includeOriginal' => true, |
| 243 |
|
'includeHostForOriginal' => true, |
| 244 |
|
]); |
| 245 |
|
|
| 246 |
|
static::assertEquals('/uploads/photo.jpg', $data['photo']); |
| 247 |
|
static::assertFalse(strpos($data['cover']['original'], 'https://example.com:8800')); |
| 248 |
|
static::assertEquals('https://example.com:8800/uploads/photo.jpg', $data['photoThumb']['original']); |
| 249 |
|
} |
| 250 |
|
|
| 251 |
|
/** |
| 252 |
|
* Test serialization with host in url and host in url for original |
|
@@ 254-269 (lines=16) @@
|
| 251 |
|
/** |
| 252 |
|
* Test serialization with host in url and host in url for original |
| 253 |
|
*/ |
| 254 |
|
public function testSerializationWithHostAndHostForOriginal() |
| 255 |
|
{ |
| 256 |
|
$userPictures = new UserPictures(); |
| 257 |
|
$this->generateCacheManager(); |
| 258 |
|
$this->generateRequestContext(true, true); |
| 259 |
|
$data = $this->serializeObject($userPictures, [ |
| 260 |
|
'includeHost' => true, |
| 261 |
|
'vichUploaderSerialize' => true, |
| 262 |
|
'includeOriginal' => true, |
| 263 |
|
'includeHostForOriginal' => true, |
| 264 |
|
]); |
| 265 |
|
|
| 266 |
|
static::assertEquals('https://example.com:8800/uploads/photo.jpg', $data['photo']); |
| 267 |
|
static::assertFalse(strpos($data['cover']['original'], 'https://example.com:8800')); |
| 268 |
|
static::assertEquals('https://example.com:8800/uploads/photo.jpg', $data['photoThumb']['original']); |
| 269 |
|
} |
| 270 |
|
|
| 271 |
|
/** |
| 272 |
|
* Test serialization with host in url and host in url for original and non-stored (resolve path) images |
|
@@ 317-331 (lines=15) @@
|
| 314 |
|
/** |
| 315 |
|
* Test serialization with no host in url and no host in url for original and ONE non-stored (resolve path) image |
| 316 |
|
*/ |
| 317 |
|
public function testSerializationWithNoHostAndNoHostForOriginalAndOneNonStoredImage() |
| 318 |
|
{ |
| 319 |
|
$userPictures = new UserPictures(); |
| 320 |
|
$this->generateCacheManager('https://example.com:8800/', false); |
| 321 |
|
$this->generateRequestContext(true, true); |
| 322 |
|
$data = $this->serializeObject($userPictures, [ |
| 323 |
|
'includeHost' => false, |
| 324 |
|
'vichUploaderSerialize' => true, |
| 325 |
|
'includeOriginal' => true, |
| 326 |
|
'includeHostForOriginal' => false, |
| 327 |
|
]); |
| 328 |
|
|
| 329 |
|
static::assertEquals('/uploads/photo.jpg', $data['photoThumb']['original']); |
| 330 |
|
static::assertEquals('/a/path/to/an/resolve/image3.png', $data['photoThumb']['thumb_filter']); |
| 331 |
|
} |
| 332 |
|
|
| 333 |
|
/** |
| 334 |
|
* Test serialization without host in url and array of filters |