github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/pkg/cataloger/wordpress/parse_plugin_test.go (about) 1 package wordpress 2 3 import ( 4 "testing" 5 6 "github.com/anchore/syft/syft/file" 7 "github.com/anchore/syft/syft/pkg" 8 "github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest" 9 ) 10 11 func TestParseWordpressPluginFiles(t *testing.T) { 12 fixture := "test-fixtures/glob-paths/wp-content/plugins/akismet/akismet.php" 13 locations := file.NewLocationSet(file.NewLocation(fixture)) 14 15 var expectedPkg = pkg.Package{ 16 Name: "Akismet Anti-spam: Spam Protection", 17 Version: "5.3", 18 Locations: locations, 19 Type: pkg.WordpressPluginPkg, 20 Licenses: pkg.NewLicenseSet( 21 pkg.NewLicenseFromLocations("GPLv2"), 22 ), 23 Language: pkg.PHP, 24 Metadata: pkg.WordpressPluginEntry{ 25 PluginInstallDirectory: "akismet", 26 Author: "Automattic - Anti-spam Team", 27 AuthorURI: "https://automattic.com/wordpress-plugins/", 28 }, 29 } 30 31 pkgtest.TestFileParser(t, fixture, parseWordpressPluginFiles, []pkg.Package{expectedPkg}, nil) 32 }