summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormo khan <mo.khan@gmail.com>2020-08-04 12:22:08 -0600
committermo khan <mo.khan@gmail.com>2020-08-04 18:11:01 -0600
commit3ee6d1113b57f9fdc3b093a75d5c79ef04078b21 (patch)
treeef205f1d6ec5d8aefa0b50a60ac620e3f8608068 /spec
parented6e39123472fecf4eb8fef1e75db28a3b4d1ff2 (diff)
Add spec to reproduce error in offline env
Diffstat (limited to 'spec')
-rw-r--r--spec/fixtures/php/composer/unreachable-network/composer.json5
-rw-r--r--spec/fixtures/php/composer/unreachable-network/composer.lock62
-rw-r--r--spec/integration/php/composer_spec.rb12
3 files changed, 79 insertions, 0 deletions
diff --git a/spec/fixtures/php/composer/unreachable-network/composer.json b/spec/fixtures/php/composer/unreachable-network/composer.json
new file mode 100644
index 0000000..4c5e225
--- /dev/null
+++ b/spec/fixtures/php/composer/unreachable-network/composer.json
@@ -0,0 +1,5 @@
+{
+ "require": {
+ "monolog/monolog": "1.0.*"
+ }
+}
diff --git a/spec/fixtures/php/composer/unreachable-network/composer.lock b/spec/fixtures/php/composer/unreachable-network/composer.lock
new file mode 100644
index 0000000..73a6647
--- /dev/null
+++ b/spec/fixtures/php/composer/unreachable-network/composer.lock
@@ -0,0 +1,62 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "bef20e1ca06eac6c027a5bc95193a923",
+ "packages": [
+ {
+ "name": "monolog/monolog",
+ "version": "1.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://example.com/Seldaek/monolog.git",
+ "reference": "b704c49a3051536f67f2d39f13568f74615b9922"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.example.com/repos/Seldaek/monolog/zipball/b704c49a3051536f67f2d39f13568f74615b9922",
+ "reference": "b704c49a3051536f67f2d39f13568f74615b9922",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Monolog": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jordi Boggiano",
+ "email": "j.boggiano@seld.be",
+ "homepage": "http://seld.be",
+ "role": "Developer"
+ }
+ ],
+ "description": "Logging for PHP 5.3",
+ "homepage": "http://example.com/Seldaek/monolog",
+ "keywords": [
+ "log",
+ "logging"
+ ],
+ "time": "2011-10-24T09:39:02+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": [],
+ "plugin-api-version": "1.1.0"
+}
diff --git a/spec/integration/php/composer_spec.rb b/spec/integration/php/composer_spec.rb
index 0fb09ee..7a1c274 100644
--- a/spec/integration/php/composer_spec.rb
+++ b/spec/integration/php/composer_spec.rb
@@ -118,4 +118,16 @@ RSpec.describe "composer" do
expect(subject.licenses_for('monolog/monolog')).to match_array(['MIT'])
end
end
+
+ context "when scanning a project with a lock file and sourced from an unreachable network location" do
+ before do
+ runner.mount(dir: fixture_file('php/composer/unreachable-network'))
+ end
+
+ it 'parses the informatio from the lockfile' do
+ expect(subject).to match_schema
+ expect(subject.dependency_names).to match_array(['monolog/monolog'])
+ expect(subject.licenses_for('monolog/monolog')).to match_array(['MIT'])
+ end
+ end
end