src/Serialize/Serializer/ArraySerializer.php 1 location
|
@@ 39-48 (lines=10) @@
|
| 36 |
|
* |
| 37 |
|
* @return mixed |
| 38 |
|
*/ |
| 39 |
|
public function deserialize($data, string $type, Specification $specification) |
| 40 |
|
{ |
| 41 |
|
$array = json_decode($data, true); |
| 42 |
|
|
| 43 |
|
if (!is_array($array)) { |
| 44 |
|
throw new \UnexpectedValueException("Expected result to be an array"); |
| 45 |
|
} |
| 46 |
|
|
| 47 |
|
return $array; |
| 48 |
|
} |
| 49 |
|
} |
| 50 |
|
|
src/Tests/Request/ContentDecoder/ContentDecoderTest.php 1 location
|
@@ 59-67 (lines=9) @@
|
| 56 |
|
|
| 57 |
|
$mock->expects($this->any()) |
| 58 |
|
->method('deserialize') |
| 59 |
|
->willReturnCallback(function (string $value) { |
| 60 |
|
$array = json_decode($value, true); |
| 61 |
|
|
| 62 |
|
if (!is_array($array)) { |
| 63 |
|
throw new \UnexpectedValueException("Expected result to be an array"); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
return $array; |
| 67 |
|
}); |
| 68 |
|
|
| 69 |
|
$documentRepository = $this |
| 70 |
|
->getMockBuilder(DocumentRepository::class) |