| @@ 32-47 (lines=16) @@ | ||
| 29 | $this->assertEquals($expected, $this->update->getText()); |
|
| 30 | } |
|
| 31 | ||
| 32 | public function testDate() |
|
| 33 | { |
|
| 34 | $expected = new \DateTime('1990-05-08 00:00:00'); |
|
| 35 | $this->assertNull($this->update->getDate()); |
|
| 36 | $this->assertSame($this->update, $this->update->setDate($expected)); |
|
| 37 | $this->assertSame($expected, $this->update->getDate()); |
|
| 38 | ||
| 39 | $this->update->setDate(['date' => '1990-05-08 00:00:00']); |
|
| 40 | $this->assertInstanceOf('DateTime', $this->update->getDate()); |
|
| 41 | ||
| 42 | $this->update->setDate(['date' => '1990-05-08 00:00:00', 'timezone' => 'Europe/Berlin']); |
|
| 43 | $this->assertInstanceOf('DateTime', $this->update->getDate()); |
|
| 44 | ||
| 45 | $this->update->setDate('1990-05-08 00:00:00'); |
|
| 46 | $this->assertInstanceOf('DateTime', $this->update->getDate()); |
|
| 47 | } |
|
| 48 | ||
| 49 | public function testType() |
|
| 50 | { |
|
| @@ 59-74 (lines=16) @@ | ||
| 56 | $this->assertEquals($expected, $this->user->getAvatar()); |
|
| 57 | } |
|
| 58 | ||
| 59 | public function testDateOfBirth() |
|
| 60 | { |
|
| 61 | $expected = new \DateTime('1990-05-08 00:00:00'); |
|
| 62 | $this->assertNull($this->user->getDateOfBirth()); |
|
| 63 | $this->assertSame($this->user, $this->user->setDateOfBirth($expected)); |
|
| 64 | $this->assertSame($expected, $this->user->getDateOfBirth()); |
|
| 65 | ||
| 66 | $this->user->setDateOfBirth(['date' => '1990-05-08 00:00:00']); |
|
| 67 | $this->assertInstanceOf('DateTime', $this->user->getDateOfBirth()); |
|
| 68 | ||
| 69 | $this->user->setDateOfBirth(['date' => '1990-05-08 00:00:00', 'timezone' => 'Europe/Berlin']); |
|
| 70 | $this->assertInstanceOf('DateTime', $this->user->getDateOfBirth()); |
|
| 71 | ||
| 72 | $this->user->setDateOfBirth('1990-05-08 00:00:00'); |
|
| 73 | $this->assertInstanceOf('DateTime', $this->user->getDateOfBirth()); |
|
| 74 | } |
|
| 75 | ||
| 76 | public function testInvalidDateOfBirthSetsItToNull() |
|
| 77 | { |
|