Skip to content

Instantly share code, notes, and snippets.

@cs278
Created July 4, 2012 13:52
Show Gist options
  • Save cs278/3047451 to your computer and use it in GitHub Desktop.
Save cs278/3047451 to your computer and use it in GitHub Desktop.
Composer upper case branch test case #872
#!/bin/bash
DIR=$(mktemp -t -d composer.XXX)
# Change me if required
COMPOSER_BIN=${COMPOSER_BIN:-$(which composer)}
echo "Running test case in '$DIR' against $($COMPOSER_BIN --version)"
git init "$DIR/dependency"
mkdir "$DIR/my-super-project"
echo '{ "name": "example/dependency" }' > "$DIR/dependency/composer.json"
(cd "$DIR/dependency" && git checkout -b branchWithCaps && git add composer.json && git commit -m 'Initial commit') > /dev/null
(cat <<EOF
{
"require": {
"example/dependency": "dev-branchWithCaps"
},
"repositories": [
{
"type": "vcs",
"url": "file://$DIR/dependency"
},
{"packagist": false}
]
}
EOF
)> "$DIR/my-super-project/composer.json"
cd "$DIR/my-super-project" &&
# Install without lock file
$COMPOSER_BIN install -n && [ -f vendor/example/dependency/composer.json ] && echo ">> Installed without lock file." &&
# Create lock file
$COMPOSER_BIN update -n && [ -f composer.lock ] && echo ">> Created lock file." && rm -rf vendor &&
# Install from lock file
$COMPOSER_BIN install -vn && [ -f vendor/example/dependency/composer.json ] && echo ">> Installed from lock file."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment