|
@@ 84-102 (lines=19) @@
|
| 81 |
|
$this->assertEquals('1984/01/01', $birthday->format('Y/m/d')); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
public function testBirthdayCastHandlesDateWithoutYear() |
| 85 |
|
{ |
| 86 |
|
$dataFromGraph = [ |
| 87 |
|
'birthday' => '03/21', |
| 88 |
|
]; |
| 89 |
|
|
| 90 |
|
$this->responseMock |
| 91 |
|
->shouldReceive('getDecodedBody') |
| 92 |
|
->once() |
| 93 |
|
->andReturn($dataFromGraph); |
| 94 |
|
$factory = new GraphNodeFactory($this->responseMock); |
| 95 |
|
$graphNode = $factory->makeGraphUser(); |
| 96 |
|
|
| 97 |
|
$birthday = $graphNode->getBirthday(); |
| 98 |
|
|
| 99 |
|
$this->assertTrue($birthday->hasDate()); |
| 100 |
|
$this->assertFalse($birthday->hasYear()); |
| 101 |
|
$this->assertEquals('03/21', $birthday->format('m/d')); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
public function testBirthdayCastHandlesYearWithoutDate() |
| 105 |
|
{ |
|
@@ 104-122 (lines=19) @@
|
| 101 |
|
$this->assertEquals('03/21', $birthday->format('m/d')); |
| 102 |
|
} |
| 103 |
|
|
| 104 |
|
public function testBirthdayCastHandlesYearWithoutDate() |
| 105 |
|
{ |
| 106 |
|
$dataFromGraph = [ |
| 107 |
|
'birthday' => '1984', |
| 108 |
|
]; |
| 109 |
|
|
| 110 |
|
$this->responseMock |
| 111 |
|
->shouldReceive('getDecodedBody') |
| 112 |
|
->once() |
| 113 |
|
->andReturn($dataFromGraph); |
| 114 |
|
$factory = new GraphNodeFactory($this->responseMock); |
| 115 |
|
$graphNode = $factory->makeGraphUser(); |
| 116 |
|
|
| 117 |
|
$birthday = $graphNode->getBirthday(); |
| 118 |
|
|
| 119 |
|
$this->assertTrue($birthday->hasYear()); |
| 120 |
|
$this->assertFalse($birthday->hasDate()); |
| 121 |
|
$this->assertEquals('1984', $birthday->format('Y')); |
| 122 |
|
} |
| 123 |
|
|
| 124 |
|
public function testPagePropertiesWillGetCastAsGraphPageObjects() |
| 125 |
|
{ |