|
@@ 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 event subscriber |
|
@@ 237-250 (lines=14) @@
|
| 234 |
|
/** |
| 235 |
|
* Test serialization without host in url and one filter |
| 236 |
|
*/ |
| 237 |
|
public function testSerializationWithoutHost() |
| 238 |
|
{ |
| 239 |
|
$userPictures = new User(); |
| 240 |
|
$this->generateCacheManager('/'); |
| 241 |
|
$this->generateRequestContext(true, true); |
| 242 |
|
$data = $this->serializeObject($userPictures, [ |
| 243 |
|
'includeHost' => false, |
| 244 |
|
'vichUploaderSerialize' => true, |
| 245 |
|
'includeOriginal' => false, |
| 246 |
|
]); |
| 247 |
|
|
| 248 |
|
static::assertEquals('/a/path/to/an/image1.png', $data['cover']); |
| 249 |
|
static::assertEquals('/a/path/to/an/image2.png', $data['photo']); |
| 250 |
|
} |
| 251 |
|
|
| 252 |
|
/** |
| 253 |
|
* Test serialization with host in url for original |