Skip to content
Merged
Next Next commit
Add test case
  • Loading branch information
theofidry committed Jul 9, 2022
commit caa0b1c19d4fbef5731bd50bd2af1d3448ad7614
5 changes: 5 additions & 0 deletions e2e/scenario7/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/actual.txt
/composer.lock
/vendor/
/vendor-bin/*/composer.lock
/vendor-bin/*/vendor/
1 change: 1 addition & 0 deletions e2e/scenario7/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tests that extra arguments and options are not lost when forwarding the command to a bin namespace.
21 changes: 21 additions & 0 deletions e2e/scenario7/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"repositories": [
{
"type": "path",
"url": "../../"
}
],
"require": {
"bamarni/composer-bin-plugin": "dev-master"
},
"config": {
"allow-plugins": {
"bamarni/composer-bin-plugin": true
}
},
"extra": {
"bamarni-bin": {
"forward-command": true
}
}
}
22 changes: 22 additions & 0 deletions e2e/scenario7/expected.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Locking bamarni/composer-bin-plugin (dev-hash)
Writing lock file
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals
- Installing bamarni/composer-bin-plugin (dev-hash): Symlinking from ../..
Generating autoload files
[bamarni-bin] The command is being forwarded.
Loading composer repositories with package information
Updating dependencies
Lock file operations: 2 installs, 0 updates, 0 removals
- Locking nikic/iter (v1.6.0)
- Locking phpstan/phpstan (1.8.0)
Writing lock file
Installing dependencies from lock file
Package operations: 1 install, 0 updates, 0 removals
- Installing nikic/iter (v1.6.0): Extracting archive
Generating autoload files
–––––––––––––––––––––
nikic/iter
22 changes: 22 additions & 0 deletions e2e/scenario7/script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

set -Eeuo pipefail

readonly ORIGINAL_WORKING_DIR=$(pwd)

trap "cd ${ORIGINAL_WORKING_DIR}" err exit

# Change to script directory
cd "$(dirname "$0")"

# Ensure we have a clean state
rm -rf actual.txt || true
rm -rf composer.lock || true
rm -rf vendor || true
rm -rf vendor-bin/*/composer.lock || true
rm -rf vendor-bin/*/vendor || true

# Actual command to execute the test itself
composer update --no-dev 2>&1 | tee > actual.txt || true
echo "–––––––––––––––––––––" >> actual.txt
composer bin ns1 show --direct --name-only 2>&1 | tee >> actual.txt || true
8 changes: 8 additions & 0 deletions e2e/scenario7/vendor-bin/ns1/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"require": {
"nikic/iter": "v1.6.0"
},
"require-dev": {
"phpstan/phpstan": "1.8.0"
}
}