diff --git a/mocks/database/gorm/Gorm.go b/mocks/database/gorm/Gorm.go new file mode 100644 index 000000000..d54514ebc --- /dev/null +++ b/mocks/database/gorm/Gorm.go @@ -0,0 +1,53 @@ +// Code generated by mockery v2.34.2. DO NOT EDIT. + +package mocks + +import ( + mock "github.com/stretchr/testify/mock" + gorm "gorm.io/gorm" +) + +// Gorm is an autogenerated mock type for the Gorm type +type Gorm struct { + mock.Mock +} + +// Make provides a mock function with given fields: +func (_m *Gorm) Make() (*gorm.DB, error) { + ret := _m.Called() + + var r0 *gorm.DB + var r1 error + if rf, ok := ret.Get(0).(func() (*gorm.DB, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() *gorm.DB); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*gorm.DB) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// NewGorm creates a new instance of Gorm. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewGorm(t interface { + mock.TestingT + Cleanup(func()) +}) *Gorm { + mock := &Gorm{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/mocks/database/gorm/Initialize.go b/mocks/database/gorm/Initialize.go index 1f899b28f..191ba88d5 100644 --- a/mocks/database/gorm/Initialize.go +++ b/mocks/database/gorm/Initialize.go @@ -7,9 +7,11 @@ import ( config "github.com/goravel/framework/contracts/config" - gorm "github.com/goravel/framework/database/gorm" + gorm "github.com/goravel/framework/contracts/database/gorm" mock "github.com/stretchr/testify/mock" + + orm "github.com/goravel/framework/contracts/database/orm" ) // Initialize is an autogenerated mock type for the Initialize type @@ -18,15 +20,15 @@ type Initialize struct { } // InitializeGorm provides a mock function with given fields: _a0, connection -func (_m *Initialize) InitializeGorm(_a0 config.Config, connection string) *gorm.GormImpl { +func (_m *Initialize) InitializeGorm(_a0 config.Config, connection string) gorm.Gorm { ret := _m.Called(_a0, connection) - var r0 *gorm.GormImpl - if rf, ok := ret.Get(0).(func(config.Config, string) *gorm.GormImpl); ok { + var r0 gorm.Gorm + if rf, ok := ret.Get(0).(func(config.Config, string) gorm.Gorm); ok { r0 = rf(_a0, connection) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*gorm.GormImpl) + r0 = ret.Get(0).(gorm.Gorm) } } @@ -34,19 +36,19 @@ func (_m *Initialize) InitializeGorm(_a0 config.Config, connection string) *gorm } // InitializeQuery provides a mock function with given fields: ctx, _a1, connection -func (_m *Initialize) InitializeQuery(ctx context.Context, _a1 config.Config, connection string) (*gorm.QueryImpl, error) { +func (_m *Initialize) InitializeQuery(ctx context.Context, _a1 config.Config, connection string) (orm.Query, error) { ret := _m.Called(ctx, _a1, connection) - var r0 *gorm.QueryImpl + var r0 orm.Query var r1 error - if rf, ok := ret.Get(0).(func(context.Context, config.Config, string) (*gorm.QueryImpl, error)); ok { + if rf, ok := ret.Get(0).(func(context.Context, config.Config, string) (orm.Query, error)); ok { return rf(ctx, _a1, connection) } - if rf, ok := ret.Get(0).(func(context.Context, config.Config, string) *gorm.QueryImpl); ok { + if rf, ok := ret.Get(0).(func(context.Context, config.Config, string) orm.Query); ok { r0 = rf(ctx, _a1, connection) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*gorm.QueryImpl) + r0 = ret.Get(0).(orm.Query) } }