Files
pack/core/providers/php/php_test.go
T
2025-01-29 02:51:06 -05:00

43 lines
762 B
Go

package php
import (
"testing"
testingUtils "github.com/railwayapp/railpack/core/testing"
"github.com/stretchr/testify/require"
)
func TestDetect(t *testing.T) {
tests := []struct {
name string
path string
want bool
}{
{
name: "index.php",
path: "../../../examples/php-vanilla",
want: true,
},
{
name: "composer",
path: "../../../examples/php-laravel-inertia",
want: true,
},
{
name: "no php",
path: "../../../examples/node-npm",
want: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
ctx := testingUtils.CreateGenerateContext(t, tt.path)
provider := PhpProvider{}
got, err := provider.Detect(ctx)
require.NoError(t, err)
require.Equal(t, tt.want, got)
})
}
}