github.com/goravel/framework@v1.13.9/testing/test_case.go (about)

     1  package testing
     2  
     3  import (
     4  	"fmt"
     5  
     6  	"github.com/goravel/framework/contracts/database/seeder"
     7  )
     8  
     9  type TestCase struct {
    10  }
    11  
    12  func (receiver *TestCase) Seed(seeds ...seeder.Seeder) {
    13  	command := "db:seed"
    14  	if len(seeds) > 0 {
    15  		command += " --seeder"
    16  		for _, seed := range seeds {
    17  			command += fmt.Sprintf(" %s", seed.Signature())
    18  		}
    19  	}
    20  
    21  	artisanFacades.Call(command)
    22  }
    23  
    24  func (receiver *TestCase) RefreshDatabase(seeds ...seeder.Seeder) {
    25  	artisanFacades.Call("migrate:refresh")
    26  }