diff --git a/Makefile b/Makefile index 55ae2b69..359a405e 100755 --- a/Makefile +++ b/Makefile @@ -47,16 +47,15 @@ $(eval TMP_DIR := $(shell mktemp -d)) mkdir -p ${TMP_DIR}/ps_eventbus; cp -r $(shell cat .zip-contents) ${TMP_DIR}/ps_eventbus; cp $1 ${TMP_DIR}/ps_eventbus/config/parameters.yml; +if [ $1 = ".config.e2e.yml" ]; then ./tests/Mocks/apply-ps-accounts-mock.sh ${TMP_DIR}/ps_eventbus; fi cd ${TMP_DIR} && zip -9 -r $2 ./ps_eventbus; mv ${TMP_DIR}/$2 ./dist; rm -rf ${TMP_DIR:-/dev/null}; endef -# target: zip-e2e - Bundle a local E2E integrable zip +# target: zip-e2e - Bundle a local E2E integrable zip zip-e2e: vendor dist .config.e2e.yml - ./tests/Mocks/apply-ps-accounts-mock.sh @$(call zip_it,.config.e2e.yml,${PACKAGE}_e2e.zip) - ./tests/Mocks/revert-ps-accounts-mock.sh # target: zip-inte - Bundle an integration zip zip-inte: vendor dist .config.inte.yml diff --git a/tests/Mocks/PsAccounts.php b/tests/Mocks/PsAccounts.php new file mode 100644 index 00000000..8b43bf05 --- /dev/null +++ b/tests/Mocks/PsAccounts.php @@ -0,0 +1,80 @@ +psAccountsMock = new PsAccountsServiceMock(); + } + + public function getService() + { + return $this->psAccountsMock; + } + + public function getPsAccountsService() + { + return $this->getService(); + } +} diff --git a/tests/Mocks/apply-ps-accounts-mock.sh b/tests/Mocks/apply-ps-accounts-mock.sh index ce7aedbd..0c270ccf 100755 --- a/tests/Mocks/apply-ps-accounts-mock.sh +++ b/tests/Mocks/apply-ps-accounts-mock.sh @@ -1,8 +1,11 @@ #!/bin/bash -cd "$(dirname "$0")" || exit 1 +[ -z "$1" ] && { + echo "Error: Please provide a path to apply this script. Example if you are at the root of the git project: $0 ./" >&2; + exit 1; +} -SRC_DIR="../../src" -CONFIG_DIR="../../config" +SRC_DIR="$1/src" +CONFIG_DIR="$1/config" SED_PARAMS=() if [[ "$OSTYPE" == "darwin"* ]]; then @@ -12,7 +15,7 @@ else fi mkdir -p "$SRC_DIR/Mock" -cp ./PSAccounts.php "$SRC_DIR/Mock/PsAccounts.php" +cp "$(dirname "$0")/PsAccounts.php" "$SRC_DIR/Mock/PsAccounts.php" # I could not just inject my PsAccounts mock with the "class" attribute in Yaml # so dumb me thought: replace the naming everywhere it will work