Skip to content

Commit

Permalink
Merge pull request #2 from Invertus/feature/api-client-mocking
Browse files Browse the repository at this point in the history
Feature / api client mocking
  • Loading branch information
tomas862 authored Nov 20, 2023
2 parents d08f1c4 + 3ea7694 commit d13b354
Show file tree
Hide file tree
Showing 34 changed files with 477 additions and 2,322 deletions.
2 changes: 2 additions & 0 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
APP_ENV=ci
PAYMENT_API_TEST_BASE_URL=http://172.17.0.1:8443
Empty file modified .github/workflows/lint.yml
100644 → 100755
Empty file.
30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: PHP tests
on: [pull_request]

jobs:
# similar job as below. Editing this one don't forget the one below
unit-system-tests:
runs-on: ubuntu-latest
strategy:
matrix:
presta-versions: ['1.7.8.0-7.4', 'latest']
steps:
- name: Checkout
uses: actions/checkout@v2.0.0

- name: Cache vendor folder
uses: actions/cache@v1
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

- name: Cache composer folder
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php-composer-cache

- run: sudo composer self-update 2.2.11
- run: cp .env.dist .env
- run: composer install
- run: make run-tests-github-actions ps_instance=${{ matrix.presta-versions }}
3 changes: 2 additions & 1 deletion .gitignore
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
vendor
.idea
.idea
.env
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

run-ps:
docker network create prestashop-net-${ps_instance} || true
docker run -ti --name some-mysql-${ps_instance} --network prestashop-net-${ps_instance} --platform ${platform} -e APP_ENV=ci -e MYSQL_ROOT_PASSWORD=admin -e MYSQL_DATABASE=prestashop -p 4420:3306 -d mariadb:10.7.4
docker run -ti -v $(ROOT_DIR):/var/www/html/modules/prestashopdevcon --platform ${platform} --name some-prestashop-${ps_instance} --network prestashop-net-${ps_instance} -e DB_SERVER=some-mysql-${ps_instance} -e PS_INSTALL_AUTO=1 -e DB_NAME=prestashop -e PS_DOMAIN=localhost:8080 -e PS_FOLDER_ADMIN=admin1 -p 8080:80 -d prestashop/prestashop:${ps_instance}

run-wiremock:
docker run -d -ti --rm --name wiremock-${ps_instance} --network prestashop-net-${ps_instance} -v $(ROOT_DIR)/wiremock:/home/wiremock -p 8443:8080 wiremock/wiremock

run-integration-tests:
docker exec -i some-prestashop-${ps_instance} sh -c "cd /var/www/html && php bin/console prestashop:module install prestashopdevcon"
docker exec -i some-prestashop-${ps_instance} sh -c "cd /var/www/html/modules/prestashopdevcon && php vendor/bin/phpunit -c tests/phpunit.xml --testsuite Integration"

run-tests-github-actions:
make run-ps ps_instance=${ps_instance} platform=linux/amd64
make run-wiremock ps_instance=${ps_instance}
sleep 2m
make run-integration-tests ps_instance=${ps_instance}
Empty file modified README.md
100644 → 100755
Empty file.
17 changes: 14 additions & 3 deletions composer.json
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
"controllers"
]
},
"autoload-dev": {
"psr-4": {
"Invertus\\Tests\\Prestashopdevcon\\": "tests/"
}
},
"config": {
"platform": {
"php": "5.6.0"
"php": "7.4.0"
},
"sort-packages": true,
"preferred-install": "dist",
Expand All @@ -25,8 +30,14 @@
"email": "tomas.ilginis@invertus.eu"
}
],
"require": {},
"require": {
"league/container": "2.5.0",
"apimatic/jsonmapper": "^2.0",
"apimatic/unirest-php": "^2.1",
"vlucas/phpdotenv": "^5.5"
},
"require-dev": {
"prestashop/php-dev-tools": "~3.0"
"phpunit/phpunit": "~9.6.13",
"prestashop/php-dev-tools": "~4.0"
}
}
Loading

0 comments on commit d13b354

Please sign in to comment.