Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(bindata): Use stable mtime in bindata generation test(composer): Add composer buildtool tests test(php): Require build tool for Composer test
- 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.