Skip to content

Commit

Permalink
Change functions for default branch from remote, and fix flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
thefrosty committed Aug 5, 2022
1 parent d5a913d commit 4fc7d24
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions bin/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ set -e

# Default values of arguments
# https://stackoverflow.com/a/44750379/558561 -- get the default git branch name
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
DEFAULT_BRANCH=$(git remote show $(git remote) | sed -n '/HEAD branch/s/.*: //p')
TEST_VERSION="7.4"
OTHER_ARGUMENTS=()

# Loop through arguments and process them
# @ref https://pretzelhands.com/posts/command-line-flags/
for arg in "$@"; do
case $arg in
--default-branch)
DEFAULT_BRANCH="$2"
shift 2 # Remove name and value
--default-branch=*)
DEFAULT_BRANCH="${arg#*=}"
shift # Remove --default-branch= from processing
;;
--test-version)
TEST_VERSION="$2"
shift 2 # Remove name and value
--test-version=*)
TEST_VERSION="${arg#*=}"
shift # Remove --test-version= from processing
;;
*)
OTHER_ARGUMENTS+=("$1")
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/Plugin/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public function testPlugin(): void
$this->assertArrayHasKey(ContainerAwareTrait::class, $traits);
$constants = $this->getClassConstants($this->reflection);
$this->assertCount(1, $constants);
$this->assertArrayHasKey($this->plugin::TAG, $constants);
$this->assertArrayHasKey('TAG', $constants);
}
}

0 comments on commit 4fc7d24

Please sign in to comment.