From a7cc4bd6ea28306b8e8a6ae73cf6723773a906f2 Mon Sep 17 00:00:00 2001 From: Yi-Jyun Pan Date: Sat, 24 Jun 2023 22:28:54 +0800 Subject: [PATCH] test(planner/php): Cover DetermineApplication --- internal/php/plan_test.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/internal/php/plan_test.go b/internal/php/plan_test.go index 2a8cc032..7d483fbd 100644 --- a/internal/php/plan_test.go +++ b/internal/php/plan_test.go @@ -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) +}