Example #1
0
 public function testCasts()
 {
     $model = new ModelStub();
     $model->score = '0.34';
     $model->data = ['foo' => 'bar'];
     $model->active = 'true';
     $this->assertTrue(is_float($model->score));
     $this->assertTrue(is_array($model->data));
     $this->assertTrue(is_bool($model->active));
     $attributes = $model->getAttributes();
     $this->assertTrue(is_string($attributes['score']));
     $this->assertTrue(is_string($attributes['data']));
     $this->assertTrue(is_string($attributes['active']));
     $array = $model->toArray();
     $this->assertTrue(is_float($array['score']));
     $this->assertTrue(is_array($array['data']));
     $this->assertTrue(is_bool($array['active']));
 }