-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #276 from fossas/fix/phpDeps
Filter out deps with name 'php'
- Loading branch information
Showing
9 changed files
with
609 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package composer_test | ||
|
||
import ( | ||
"path/filepath" | ||
"testing" | ||
|
||
"github.com/fossas/fossa-cli/analyzers" | ||
"github.com/fossas/fossa-cli/analyzers/php" | ||
"github.com/fossas/fossa-cli/module" | ||
"github.com/fossas/fossa-cli/pkg" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestNoDependenciesNamedPHP(t *testing.T) { | ||
// TODO: this really shouldn't require the build tool, but we don't currently | ||
// have a non-build-tool method or mock for Composer. We should implement this | ||
// by adding resolution from walking `composer.json` dependency manifests. | ||
if testing.Short() { | ||
t.Skip("Composer requires build tool") | ||
} | ||
|
||
// Run analysis. | ||
m := module.Module{ | ||
Name: "fixture", | ||
Type: pkg.Composer, | ||
BuildTarget: filepath.Join("testdata", "composer.json"), | ||
Dir: "testdata", | ||
} | ||
|
||
a, err := analyzers.New(m) | ||
assert.NoError(t, err) | ||
assert.IsType(t, &php.Analyzer{}, a) | ||
|
||
deps, err := a.Analyze() | ||
assert.NoError(t, err) | ||
|
||
// Ensure no PHP dependencies. | ||
for _, dep := range deps.Direct { | ||
assert.NotEqual(t, "php", dep.Resolved.Name) | ||
} | ||
|
||
for id, dep := range deps.Transitive { | ||
assert.NotEqual(t, "php", id.Name) | ||
for _, i := range dep.Imports { | ||
assert.NotEqual(t, "php", i.Resolved.Name) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "fixture", | ||
"type": "project", | ||
"require": { | ||
"php": "^7.2", | ||
"twig/twig": "^2.0" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.