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 testFirstOrCreate() { $w = Wiz::firstOrCreate(['fiz' => 'foo', 'biz' => 'boo', 'triz' => 'troo']); $this->assertInstanceOf('Vinelab\\NeoEloquent\\Tests\\Functional\\Wiz', $w); $found = Wiz::firstOrCreate(['fiz' => 'foo', 'biz' => 'boo', 'triz' => 'troo']); $this->assertEquals($w, $found); }