Skip to content

Commit

Permalink
Merge pull request #281 from PrestaShopCorp/add-tests-coverage
Browse files Browse the repository at this point in the history
ci: add tests coverage on the CI
  • Loading branch information
emmanuelgautier authored Nov 8, 2022
2 parents 727dbea + 34367df commit b883918
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/accounts-qc-php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ jobs:
presta-versions: ["latest"]
steps:
- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v3

- name: Cache vendor folder
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}
Expand Down Expand Up @@ -66,16 +66,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.0.0
uses: actions/checkout@v3

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

- name: Cache composer folder
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: php-composer-cache
Expand All @@ -96,16 +96,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

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

- name: Cache composer folder
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.composer/cache
key: php-composer-cache
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ endif
docker container exec test-phpunit sh -c "chown -R www-data:www-data ./modules/ps_accounts"
docker container exec -u www-data test-phpunit sh -c "sleep 1 && php -d memory_limit=-1 ./bin/console prestashop:module install ps_accounts"
@docker container exec -u www-data test-phpunit sh -c "echo \"Testing module v\`cat /var/www/html/modules/ps_accounts/config.xml | grep '<version>' | sed 's/^.*\[CDATA\[\(.*\)\]\].*/\1/'\`\n\""
docker container exec -u www-data --workdir /var/www/html/modules/ps_accounts test-phpunit ./vendor/bin/phpunit
docker container exec test-phpunit sh -c "pecl install xdebug && docker-php-ext-enable xdebug"
docker container exec -u www-data --workdir /var/www/html/modules/ps_accounts test-phpunit sh -c "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text"
@echo phpunit passed

phpunit-cleanup:
Expand Down
6 changes: 6 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
convertWarningsToExceptions="true"
defaultTestSuite="unit"
>
<filter>
<whitelist>
<directory suffix=".php">controller</directory>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<testsuites>
<testsuite name="all">
<directory suffix="Test.php">./tests</directory>
Expand Down

0 comments on commit b883918

Please sign in to comment.