public function testSavningDateTimeAndCarbonInstances() { $now = Carbon::now(); $dt = new DateTime(); $w = Wiz::create(['fiz' => $now, 'biz' => $dt]); $format = Wiz::getDateFormat(); $fetched = Wiz::first(); $this->assertEquals($now->format(Wiz::getDateFormat()), $fetched->fiz); $this->assertEquals($now->format(Wiz::getDateFormat()), $fetched->biz); $tomorrow = Carbon::now()->addDay(); $after = Carbon::now()->addDays(2); $fetched->fiz = $tomorrow; $fetched->biz = $after; $fetched->save(); $updated = Wiz::first(); $this->assertEquals($tomorrow->format(Wiz::getDateFormat()), $updated->fiz); $this->assertEquals($after->format(Wiz::getDateFormat()), $updated->biz); }
public function testNumericValuesPreserveDataTypes() { $w = Wiz::create(['fiz' => 1, 'biz' => 8.276123, 'triz' => 0]); $g = Wiz::find($w->id); $this->assertInternalType('int', $g->fiz); $this->assertInternalType('int', $g->triz); $this->assertInternalType('float', $g->biz); }