Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
kpodemski committed Sep 1, 2023
1 parent 3a56ba9 commit 9fec7eb
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions tests/phpstan.sh
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#!/bin/bash
set -e
PS_VERSION=$1
DOCKER_IMAGE=${DOCKER_IMAGE:-prestashop/prestashop:$PS_VERSION}

echo "Pull PrestaShop files (Tag ${PS_VERSION})..."
docker pull $DOCKER_IMAGE
set -e

# Docker images prestashop/prestashop may be used, even if the shop remains uninstalled
echo "Pull PrestaShop files (Tag ${PS_VERSION})"

echo "Get the PrestaShop sources..."
SOURCES_DIR=$(mktemp -d)
CONTAINER=$(docker create "${DOCKER_IMAGE}")
docker cp ${CONTAINER}:/var/www/html ${SOURCES_DIR}
docker rm -f ${CONTAINER}
docker rm -f temp-ps || true
docker volume rm -f ps-volume || true

echo "Add the module sources..."
cp -r ${PWD} ${SOURCES_DIR}/modules/blockreassurance
docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:$PS_VERSION

# Clear previous instance of the module in the PrestaShop volume
echo "Clear previous module"

docker exec -t --user root temp-ps rm -rf /var/www/html/modules/blockreassurance

# Run a container for PHPStan, having access to the module content and PrestaShop sources.
# This tool is outside the composer.json because of the compatibility with PHP 5.6
echo "Run PHPStan using phpstan-${PS_VERSION}.neon file"
docker run --rm \
-v ${SOURCES_DIR}:/var/www/html \
-e _PS_ROOT_DIR_=/var/www/html \
--workdir=/var/www/html/modules/blockreassurance \
phpstan/phpstan:0.12 \
analyse \
--configuration=/var/www/html/modules/blockreassurance/tests/phpstan/phpstan-$PS_VERSION.neon

echo "Closing..."
rm -rf ${SOURCES_DIR}

docker run --rm --volumes-from temp-ps \
-v $PWD:/var/www/html/modules/blockreassurance \
-e _PS_ROOT_DIR_=/var/www/html \
--workdir=/var/www/html/modules/blockreassurance phpstan/phpstan:0.12 \
analyse \
--configuration=/var/www/html/modules/blockreassurance/tests/phpstan/phpstan-$PS_VERSION.neon

0 comments on commit 9fec7eb

Please sign in to comment.