Skip to content

Commit

Permalink
feat: update mocks and only load views when exist
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Oct 6, 2023
1 parent e3fda08 commit c22488a
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 21 deletions.
8 changes: 4 additions & 4 deletions context_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
"strings"
"testing"

configmocks "github.com/goravel/framework/contracts/config/mocks"
filesystemmocks "github.com/goravel/framework/contracts/filesystem/mocks"
contractshttp "github.com/goravel/framework/contracts/http"
logmocks "github.com/goravel/framework/contracts/log/mocks"
"github.com/goravel/framework/contracts/validation"
validationmocks "github.com/goravel/framework/contracts/validation/mocks"
frameworkfilesystem "github.com/goravel/framework/filesystem"
configmocks "github.com/goravel/framework/mocks/config"
filesystemmocks "github.com/goravel/framework/mocks/filesystem"
logmocks "github.com/goravel/framework/mocks/log"
validationmocks "github.com/goravel/framework/mocks/validation"
"github.com/goravel/framework/support/json"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
Expand Down
2 changes: 1 addition & 1 deletion context_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"strings"
"testing"

configmocks "github.com/goravel/framework/contracts/config/mocks"
contractshttp "github.com/goravel/framework/contracts/http"
configmocks "github.com/goravel/framework/mocks/config"
"github.com/goravel/framework/support/json"
"github.com/stretchr/testify/assert"
)
Expand Down
2 changes: 1 addition & 1 deletion cors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"net/http"
"testing"

configmocks "github.com/goravel/framework/contracts/config/mocks"
contractshttp "github.com/goravel/framework/contracts/http"
configmocks "github.com/goravel/framework/mocks/config"
"github.com/stretchr/testify/assert"
)

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/gofiber/template/html/v2 v2.0.5
github.com/gookit/color v1.5.4
github.com/gookit/validate v1.5.1
github.com/goravel/framework v1.13.1-0.20231003133229-f9d300ecc08b
github.com/goravel/framework v1.13.1-0.20231006012150-4a6e705dbd56
github.com/spf13/cast v1.5.1
github.com/stretchr/testify v1.8.4
github.com/valyala/fasthttp v1.50.0
Expand Down Expand Up @@ -141,13 +141,13 @@ require (
go.opencensus.io v0.24.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/arch v0.3.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230315142452-642cacee5cc0 // indirect
golang.org/x/mod v0.10.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.9.1 // indirect
google.golang.org/api v0.126.0 // indirect
Expand Down
14 changes: 7 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ github.com/goravel/file-rotatelogs v0.0.0-20211215053220-2ab31dd9575c h1:obhFK91
github.com/goravel/file-rotatelogs v0.0.0-20211215053220-2ab31dd9575c/go.mod h1:YSWsLXlG16u5CWFaXNZHhEQD10+NwF3xfgDV816OwLE=
github.com/goravel/file-rotatelogs/v2 v2.4.1 h1:ogkeIFcTHSBRUBpZYiyJbpul8hkVXxHPuDbOaP78O1M=
github.com/goravel/file-rotatelogs/v2 v2.4.1/go.mod h1:euk9qr52WrzM8ICs1hecFcR4CZ/ZZOPdacHfvHgbOf0=
github.com/goravel/framework v1.13.1-0.20231003133229-f9d300ecc08b h1:e2mGuvVn8ppUMLNr/3vUiZ7kLiZ3V5QjJ2tFWJMAik4=
github.com/goravel/framework v1.13.1-0.20231003133229-f9d300ecc08b/go.mod h1:T3cmIKDQX8yxZni9QWaHtdEZjzg7he2noH6EtOemdWs=
github.com/goravel/framework v1.13.1-0.20231006012150-4a6e705dbd56 h1:9pHiJiqJVg7wuHxEVKEnIbxErTfCDFhOKifN0iU2q0A=
github.com/goravel/framework v1.13.1-0.20231006012150-4a6e705dbd56/go.mod h1:jUJTB38V9LEDneVTmNxPl8ALQXjvtirfjck4XQI12J8=
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4=
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
Expand Down Expand Up @@ -635,8 +635,8 @@ golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -812,14 +812,14 @@ golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
2 changes: 1 addition & 1 deletion group_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"net/http"
"testing"

configmocks "github.com/goravel/framework/contracts/config/mocks"
contractshttp "github.com/goravel/framework/contracts/http"
"github.com/goravel/framework/contracts/route"
configmocks "github.com/goravel/framework/mocks/config"
"github.com/goravel/framework/support/json"
"github.com/stretchr/testify/assert"
)
Expand Down
3 changes: 2 additions & 1 deletion route.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
httpcontract "github.com/goravel/framework/contracts/http"
"github.com/goravel/framework/contracts/route"
"github.com/goravel/framework/support"
"github.com/goravel/framework/support/file"
"github.com/goravel/framework/support/json"
)

Expand Down Expand Up @@ -49,7 +50,7 @@ func NewRoute(config config.Config, parameters map[string]any) (*Route, error) {
}
}

if views == nil {
if views == nil && file.Exists("./resources/views") {
views = html.New("./resources/views", ".tmpl")
}

Expand Down
2 changes: 1 addition & 1 deletion route_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

"github.com/gofiber/fiber/v2"
"github.com/gofiber/template/html/v2"
configmocks "github.com/goravel/framework/contracts/config/mocks"
contractshttp "github.com/goravel/framework/contracts/http"
"github.com/goravel/framework/contracts/validation"
configmocks "github.com/goravel/framework/mocks/config"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"net/http"
"testing"

configmocks "github.com/goravel/framework/contracts/config/mocks"
contractshttp "github.com/goravel/framework/contracts/http"
httpmocks "github.com/goravel/framework/contracts/http/mocks"
configmocks "github.com/goravel/framework/mocks/config"
httpmocks "github.com/goravel/framework/mocks/http"
"github.com/goravel/framework/support/file"
"github.com/stretchr/testify/assert"
)
Expand Down

0 comments on commit c22488a

Please sign in to comment.