github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/pkg/cataloger/php/parse_pecl_serialized_test.go (about)

     1  package php
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/anchore/syft/syft/artifact"
     7  	"github.com/anchore/syft/syft/file"
     8  	"github.com/anchore/syft/syft/pkg"
     9  	"github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest"
    10  )
    11  
    12  func TestParsePeclSerialized(t *testing.T) {
    13  	var expectedRelationships []artifact.Relationship
    14  	fixture := "test-fixtures/memcached.reg"
    15  	locations := file.NewLocationSet(file.NewLocation(fixture))
    16  	expectedPkgs := []pkg.Package{
    17  		{
    18  			Name:      "memcached",
    19  			Version:   "3.2.0",
    20  			PURL:      "pkg:pecl/memcached@3.2.0",
    21  			Locations: locations,
    22  			Licenses: pkg.NewLicenseSet(
    23  				pkg.NewLicenseFromLocations("PHP License", file.NewLocation(fixture)),
    24  			),
    25  			Language: pkg.PHP,
    26  			Type:     pkg.PhpPeclPkg,
    27  			Metadata: pkg.PhpPeclEntry{
    28  				Name:    "memcached",
    29  				Version: "3.2.0",
    30  				License: []string{"PHP License"},
    31  			},
    32  		},
    33  	}
    34  	pkgtest.TestFileParser(t, fixture, parsePeclSerialized, expectedPkgs, expectedRelationships)
    35  }