示例#1
0
 public function testGetterAndSetterFilters()
 {
     $date = new \DateTime('1980-10-05');
     $obj = new MyModel(['username' => 'Matt', 'subscription_date' => $date]);
     $this->assertInstanceOf('DateTime', $obj->subscription_date, 'Property "subscription_date" should be a DateTime object.');
     $this->assertInternalType('string', $obj->getRawProperty('subscription_date'), 'Raw Property "subscription_date" should be a string.');
     if (!getenv('CI')) {
         $obj->save();
         $this->assertNotEmpty($obj->user_id, 'Property id should not be empty.');
     }
 }