Skip to content

Setup integration tests for API endpoints #27

Setup integration tests for API endpoints

Setup integration tests for API endpoints #27

Workflow file for this run

name: Integration tests
on:
push:
pull_request:
permissions:
contents: read # to clone the repos and get release assets (shivammathur/setup-php)
jobs:
integration:
permissions:
contents: read # to clone the repos and get release assets (shivammathur/setup-php)
name: Integration tests
runs-on: ubuntu-latest
strategy:
matrix:
php: [ '8.1', '8.2' ]
fail-fast: false
steps:
- name: Checkout module code
uses: actions/checkout@v3
with:
path: ps_apiresources
- uses: actions/checkout@v3
name: Checkout PrestaShop repository
with:
fetch-depth: 0
repository: PrestaShop/PrestaShop
path: prestashop
- name: Run ci.sh script
run: |
mkdir -p prestashop/modules/ps_apiresources
cp -r ps_apiresources/ prestashop/modules/ps_apiresources
cd prestashop
USER_ID=$(id -u) GROUP_ID=$(id -g) PS_INSTALL_AUTO=0 docker-compose build --no-cache && docker-compose up --force-recreate
if [ $? -ne 0 ]; then
echo "docker install failed"
exit
fi
bash -l -c 'while [[ "$(curl -L -o /dev/null -w %{http_code} 'http://localhost:8001/install-dev/')" != "200" ]]; do echo "waiting for shop install"; sleep 5; done'
USER_ID=$(id -u) GROUP_ID=$(id -g) docker-compose exec prestashop-git composer install --no-interaction --working-dir=/var/www/html/modules/ps_apiresources
USER_ID=$(id -u) GROUP_ID=$(id -g) docker-compose exec prestashop-git composer create-test-db
USER_ID=$(id -u) GROUP_ID=$(id -g) docker-compose exec prestashop-git vendor/bin/phpunit modules/ps_apiresources/tests/* -c modules/ps_apiresources/tests/Integration/phpunit.xml