mirror of
https://github.com/anchore/syft.git
synced 2025-11-19 17:33:18 +01:00
83 lines
1.7 KiB
Go
83 lines
1.7 KiB
Go
package php
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/anchore/syft/syft/pkg/cataloger/internal/pkgtest"
|
|
)
|
|
|
|
func Test_ComposerInstalledCataloger_Globs(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
fixture string
|
|
expected []string
|
|
}{
|
|
{
|
|
name: "obtain composer files",
|
|
fixture: "test-fixtures/glob-paths",
|
|
expected: []string{
|
|
"src/installed.json",
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
pkgtest.NewCatalogTester().
|
|
FromDirectory(t, test.fixture).
|
|
ExpectsResolverContentQueries(test.expected).
|
|
TestCataloger(t, NewComposerInstalledCataloger())
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_ComposerLockCataloger_Globs(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
fixture string
|
|
expected []string
|
|
}{
|
|
{
|
|
name: "obtain composer lock files",
|
|
fixture: "test-fixtures/glob-paths",
|
|
expected: []string{
|
|
"src/composer.lock",
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
pkgtest.NewCatalogTester().
|
|
FromDirectory(t, test.fixture).
|
|
ExpectsResolverContentQueries(test.expected).
|
|
TestCataloger(t, NewComposerLockCataloger())
|
|
})
|
|
}
|
|
}
|
|
|
|
func Test_PeclCataloger_Globs(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
fixture string
|
|
expected []string
|
|
}{
|
|
{
|
|
name: "obtain pecl files",
|
|
fixture: "test-fixtures/glob-paths",
|
|
expected: []string{
|
|
"php/.registry/.channel.pecl.php.net/memcached.reg",
|
|
},
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
pkgtest.NewCatalogTester().
|
|
FromDirectory(t, test.fixture).
|
|
ExpectsResolverContentQueries(test.expected).
|
|
TestCataloger(t, NewPeclCataloger())
|
|
})
|
|
}
|
|
}
|