Esempio n. 1
0
 public function testSoftDelete()
 {
     $user = new Soft();
     $user->name = 'Softy';
     $user->save();
     $this->assertEquals(true, $user->exists);
     $user->delete();
     $check = Soft::find($user->_id);
     $this->assertEquals(null, $check);
     $all = Soft::get();
     $this->assertEquals(0, $all->count());
     $all = Soft::withTrashed()->get();
     $this->assertEquals(1, $all->count());
     $check = $all[0];
     $this->assertInstanceOf('Carbon\\Carbon', $check->deleted_at);
     $this->assertEquals(true, $check->trashed());
     $check->restore();
     $all = Soft::get();
     $this->assertEquals(1, $all->count());
 }