public function test_date() { $r = new Content(); $d = $r->date; $this->assertInstanceOf('ICanBoogie\\DateTime', $d); $this->assertTrue($d->is_empty); $this->assertEquals('UTC', $d->zone->name); $this->assertEquals('0000-00-00 00:00:00', $d->as_db); $r->date = '2013-03-07 18:30:45'; $d = $r->date; $this->assertInstanceOf('ICanBoogie\\DateTime', $d); $this->assertFalse($d->is_empty); $this->assertEquals('UTC', $d->zone->name); $this->assertEquals('2013-03-07 18:30:45', $d->as_db); $r->date = new DateTime('2013-03-07 18:30:45', 'utc'); $d = $r->date; $this->assertInstanceOf('ICanBoogie\\DateTime', $d); $this->assertFalse($d->is_empty); $this->assertEquals('UTC', $d->zone->name); $this->assertEquals('2013-03-07 18:30:45', $d->as_db); $r->date = null; $this->assertInstanceOf('ICanBoogie\\DateTime', $d); $r->date = DateTime::now(); $properties = $r->__sleep(); $this->assertArrayHasKey('date', $properties); $array = $r->to_array(); $this->assertArrayHasKey('date', $array); }
/** * Defaults model to `news`. */ public function __construct($model = 'news') { parent::__construct($model); }