Skip to content

Commit

Permalink
test(planner/php): Cover DetermineApplication
Browse files Browse the repository at this point in the history
  • Loading branch information
pan93412 committed Jun 24, 2023
1 parent 06d6b6a commit a7cc4bd
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions internal/php/plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,30 @@ func TestDetermineProjectFramework_Unknown(t *testing.T) {
framework := php.DetermineProjectFramework(fs)
assert.Equal(t, framework, types.PHPFrameworkNone)
}

func TestDetermineApplication_NoComposer(t *testing.T) {
fs := afero.NewMemMapFs()

app := php.DetermineApplication(fs)
assert.Equal(t, app, types.PHPApplicationDefault)
}

func TestDetermineApplication_Unknown(t *testing.T) {
fs := afero.NewMemMapFs()
_ = afero.WriteFile(fs, "composer.json", []byte(`{
"name": "test"
}`), 0o644)

app := php.DetermineApplication(fs)
assert.Equal(t, app, types.PHPApplicationDefault)
}

func TestDetermineApplication_AcgFaka(t *testing.T) {
fs := afero.NewMemMapFs()
_ = afero.WriteFile(fs, "composer.json", []byte(`{
"name": "lizhipay/acg-faka"
}`), 0o644)

app := php.DetermineApplication(fs)
assert.Equal(t, app, types.PHPApplicationAcgFaka)
}

0 comments on commit a7cc4bd

Please sign in to comment.