Skip to content

Commit

Permalink
test: ensure we use the alternate composer location
Browse files Browse the repository at this point in the history
  • Loading branch information
ramsey committed Dec 31, 2021
1 parent 9389fa5 commit 3c51967
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/composer_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,6 @@ if [ -n "${working_directory}" ]; then
composer_options+=("--working-dir" "${working_directory}")
fi

echo "::debug::Using the following Composer command: 'composer ${composer_command} ${composer_options[*]}'"
"${php_path}" "${composer_path}" "${composer_command}" "${composer_options[@]}"
full_command="${composer_path} ${composer_command} ${composer_options[*]}"
echo "::debug::Using the following Composer command: '${full_command}'"
$full_command
13 changes: 13 additions & 0 deletions tests/expect/composer_install_18.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env -S expect -f

set timeout 3
spawn ../../bin/composer_install.sh "" "" "" "" "../fixtures/composer.phar" "composer.lock"
match_max 100000

expect "::debug::Using the following Composer command: '../fixtures/composer.phar install --no-interaction --no-progress --ansi'"
expect "Installing dependencies"
expect "Generating autoload files"
expect eof

# Clean up
file delete -force vendor
15 changes: 15 additions & 0 deletions tests/expect/composer_install_19.exp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env -S expect -f

set timeout 3
spawn ../../bin/composer_install.sh "" "" "../fixtures/no-lock-file" "" "" ""
match_max 100000

expect "::debug::Using the following Composer command: '*/composer update --no-interaction --no-progress --ansi --working-dir ../fixtures/no-lock-file'"
expect "Updating dependencies"
expect "Writing lock file"
expect "Generating autoload files"
expect eof

# Clean up
file delete -force ../fixtures/no-lock-file/vendor
file delete -force ../fixtures/no-lock-file/composer.lock
17 changes: 17 additions & 0 deletions tests/expect/composer_paths_09.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/composer.phar"
match_max 100000

expect "::debug::Composer path is '../fixtures/composer.phar'\r
::debug::Composer version 2.2.2 2021-12-29 14:15:27\r
::debug::Composer cache directory found at '*'\r
::debug::File composer.json found at './composer.json'\r
::debug::File composer.lock path computed as './composer.lock'\r
::set-output name=command::../fixtures/composer.phar\r
::set-output name=cache-dir::*\r
::set-output name=json::./composer.json\r
::set-output name=lock::./composer.lock\r
"
expect eof
Binary file added tests/fixtures/composer.phar
Binary file not shown.

0 comments on commit 3c51967

Please sign in to comment.