Skip to content

Commit

Permalink
fix: don't error out on out-of-sync lock file (#213)
Browse files Browse the repository at this point in the history
As far as I can see, the `--no-check-lock` argument has been available since Composer 1.0, so adding this argument to the `composer validate` command should be safe and should prevent the issues as reported in #206.

Includes tests (though the test isn't running properly yet).

Fixes #206

Co-authored-by: jrfnl <jrfnl@users.noreply.github.com>
  • Loading branch information
jrfnl and jrfnl committed Dec 28, 2021
1 parent 6ba32f2 commit 713bde7
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions bin/composer_paths.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function validate_composer {
"${php_path}" "${composer_path}" \
validate \
--no-check-publish \
--no-check-lock \
--working-dir "${working_directory}" \
> /dev/null 2>&1
}
Expand Down
17 changes: 17 additions & 0 deletions tests/expect/composer_paths_08.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env -S expect -f

set timeout 3
spawn ../../bin/composer_paths.sh "" "../fixtures/out-of-sync-lock"
match_max 100000

expect "::debug::Composer path is '*'\r
::debug::Composer version *\r
::debug::Composer cache directory found at '*'\r
::debug::File composer.json found at '../fixtures/out-of-sync-lock/composer.json'\r
::debug::File composer.lock path computed as '../fixtures/out-of-sync-lock/composer.lock'\r
::set-output name=command::*\r
::set-output name=cache-dir::*\r
::set-output name=json::../fixtures/out-of-sync-lock/composer.json\r
::set-output name=lock::../fixtures/out-of-sync-lock/composer.lock\r
"
expect eof
16 changes: 16 additions & 0 deletions tests/fixtures/out-of-sync-lock/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "ramsey/composer-install-test-out-of-sync-lock",
"description": "Tests composer-install when composer.lock file is out of sync.",
"license": "MIT",
"authors": [
{
"name": "Ben Ramsey",
"email": "ben@benramsey.com"
}
],
"config": {
"platform": {

}
}
}
21 changes: 21 additions & 0 deletions tests/fixtures/out-of-sync-lock/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 713bde7

Please sign in to comment.