Skip to content

Commit 4ce47db

Browse files
committed
add specs
1 parent 9668221 commit 4ce47db

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

composer/spec/dependabot/composer/update_checker/version_resolver_spec.rb

+17
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,23 @@
167167
end
168168
end
169169
end
170+
171+
context "when the PHP version is invalid" do
172+
let(:project_name) { "php_version_invalid_with_lock_file" }
173+
let(:dependency_name) { "phpunit/phpunit" }
174+
let(:dependency_version) { "12.1.0" }
175+
let(:string_req) { ">=10.0.16, ==12.1.0" }
176+
let(:latest_allowable_version) { Gem::Version.new("12.1.0") }
177+
178+
it "raises a Dependabot::ToolVersionNotSupported error with correct version details" do
179+
expect { resolver.latest_resolvable_version }
180+
.to raise_error(Dependabot::ToolVersionNotSupported) do |error|
181+
expect(error.tool_name).to eq("PHP")
182+
expect(error.detected_version).to eq("8.2.28")
183+
expect(error.supported_versions).to eq(">=8.3")
184+
end
185+
end
186+
end
170187
end
171188

172189
context "when updating a subdependency that's not required anymore" do
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"content-hash": "abcdef1234567890abcdef1234567890",
3+
"require": {
4+
"phpunit/phpunit": ">=10.0.16, ==12.1.0"
5+
}
6+
}

composer/spec/fixtures/projects/php_version_invalid_with_lock_file/composer.lock

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)