|
@@ 142-156 (lines=15) @@
|
| 139 |
|
/** |
| 140 |
|
* Test serialization with origin normalizer |
| 141 |
|
*/ |
| 142 |
|
public function testSerializationWithOriginNormalizer() |
| 143 |
|
{ |
| 144 |
|
$userPictures = new UserPictures(); |
| 145 |
|
$this->generateCacheManager(); |
| 146 |
|
$this->generateRequestContext(); |
| 147 |
|
$data = $this->serializeObject($userPictures, [ |
| 148 |
|
'includeHost' => false, |
| 149 |
|
'vichUploaderSerialize' => true, |
| 150 |
|
'includeOriginal' => true, |
| 151 |
|
'originUrlNormalizer' => OriginUrlNormalizer::class, |
| 152 |
|
]); |
| 153 |
|
|
| 154 |
|
static::assertEquals('/uploads/newPhoto.jpg', $data['photoThumb']['original']); |
| 155 |
|
static::assertEquals('/uploads/newPhoto.jpg', $data['photo']); |
| 156 |
|
} |
| 157 |
|
|
| 158 |
|
/** |
| 159 |
|
* Test serialization with filtered normalizer |
|
@@ 161-175 (lines=15) @@
|
| 158 |
|
/** |
| 159 |
|
* Test serialization with filtered normalizer |
| 160 |
|
*/ |
| 161 |
|
public function testSerializationWithFilteredNormalizer() |
| 162 |
|
{ |
| 163 |
|
$userPictures = new UserPictures(); |
| 164 |
|
$this->generateCacheManager(); |
| 165 |
|
$this->generateRequestContext(); |
| 166 |
|
$data = $this->serializeObject($userPictures, [ |
| 167 |
|
'includeHost' => true, |
| 168 |
|
'vichUploaderSerialize' => true, |
| 169 |
|
'includeOriginal' => true, |
| 170 |
|
'filteredUrlNormalizer' => FilteredUrlNormalizer::class, |
| 171 |
|
]); |
| 172 |
|
|
| 173 |
|
static::assertEquals('http://img.example.com:8800/a/path/to/an/image3.png', $data['photoThumb']['thumb_filter']); |
| 174 |
|
static::assertEquals('http://img.example.com:8800/a/path/to/an/image1.png', $data['cover']['big']); |
| 175 |
|
} |
| 176 |
|
|
| 177 |
|
/** |
| 178 |
|
* Test serialization with url parse exception |
|
@@ 216-229 (lines=14) @@
|
| 213 |
|
/** |
| 214 |
|
* Test serialization without host in url and one filter |
| 215 |
|
*/ |
| 216 |
|
public function testSerializationWithoutHost() |
| 217 |
|
{ |
| 218 |
|
$userPictures = new User(); |
| 219 |
|
$this->generateCacheManager('/'); |
| 220 |
|
$this->generateRequestContext(true, true); |
| 221 |
|
$data = $this->serializeObject($userPictures, [ |
| 222 |
|
'includeHost' => false, |
| 223 |
|
'vichUploaderSerialize' => true, |
| 224 |
|
'includeOriginal' => false, |
| 225 |
|
]); |
| 226 |
|
|
| 227 |
|
static::assertEquals('/a/path/to/an/image1.png', $data['cover']); |
| 228 |
|
static::assertEquals('/a/path/to/an/image2.png', $data['photo']); |
| 229 |
|
} |
| 230 |
|
|
| 231 |
|
/** |
| 232 |
|
* Test serialization with host in url for original |