|
@@ 127-137 (lines=11) @@
|
| 124 |
|
$this->assertInstanceOf(\DateTime::class, $graphNodeAsArray['date']); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
public function testReturningACollectionAsJasonWillSafelyRepresentDateTimes() |
| 128 |
|
{ |
| 129 |
|
$graphNode = new GraphNode([ |
| 130 |
|
'id' => '123', |
| 131 |
|
'date' => new \DateTime('2014-07-15T03:44:53+0000'), |
| 132 |
|
]); |
| 133 |
|
|
| 134 |
|
$graphNodeAsString = $graphNode->asJson(); |
| 135 |
|
|
| 136 |
|
$this->assertEquals('{"id":"123","date":"2014-07-15T03:44:53+0000"}', $graphNodeAsString); |
| 137 |
|
} |
| 138 |
|
|
| 139 |
|
public function testAnExistingPropertyCanBeAccessed() |
| 140 |
|
{ |
|
@@ 195-202 (lines=8) @@
|
| 192 |
|
$this->assertEquals(['foo', 'bar'], $graphNode->asArray()); |
| 193 |
|
} |
| 194 |
|
|
| 195 |
|
public function testACollectionCanBeConvertedToProperJson() |
| 196 |
|
{ |
| 197 |
|
$graphNode = new GraphNode(['foo', 'bar', 123]); |
| 198 |
|
|
| 199 |
|
$graphNodeAsString = $graphNode->asJson(); |
| 200 |
|
|
| 201 |
|
$this->assertEquals('["foo","bar",123]', $graphNodeAsString); |
| 202 |
|
} |
| 203 |
|
|
| 204 |
|
public function testACollectionCanBeCounted() |
| 205 |
|
{ |