Skip to content

Commit 713bde7

Browse files
authored
fix: don't error out on out-of-sync lock file (#213)
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>
1 parent 6ba32f2 commit 713bde7

4 files changed

Lines changed: 55 additions & 0 deletions

File tree

bin/composer_paths.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ function validate_composer {
1212
"${php_path}" "${composer_path}" \
1313
validate \
1414
--no-check-publish \
15+
--no-check-lock \
1516
--working-dir "${working_directory}" \
1617
> /dev/null 2>&1
1718
}

tests/expect/composer_paths_08.exp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env -S expect -f
2+
3+
set timeout 3
4+
spawn ../../bin/composer_paths.sh "" "../fixtures/out-of-sync-lock"
5+
match_max 100000
6+
7+
expect "::debug::Composer path is '*'\r
8+
::debug::Composer version *\r
9+
::debug::Composer cache directory found at '*'\r
10+
::debug::File composer.json found at '../fixtures/out-of-sync-lock/composer.json'\r
11+
::debug::File composer.lock path computed as '../fixtures/out-of-sync-lock/composer.lock'\r
12+
::set-output name=command::*\r
13+
::set-output name=cache-dir::*\r
14+
::set-output name=json::../fixtures/out-of-sync-lock/composer.json\r
15+
::set-output name=lock::../fixtures/out-of-sync-lock/composer.lock\r
16+
"
17+
expect eof
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "ramsey/composer-install-test-out-of-sync-lock",
3+
"description": "Tests composer-install when composer.lock file is out of sync.",
4+
"license": "MIT",
5+
"authors": [
6+
{
7+
"name": "Ben Ramsey",
8+
"email": "ben@benramsey.com"
9+
}
10+
],
11+
"config": {
12+
"platform": {
13+
14+
}
15+
}
16+
}

tests/fixtures/out-of-sync-lock/composer.lock

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)