Skip to content

Commit

Permalink
ci: allow to lint of config files and tests files
Browse files Browse the repository at this point in the history
  • Loading branch information
Manuel Canga committed Sep 14, 2024
1 parent d8e8ae9 commit c611a56
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 3 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,17 @@ jobs:
restore-keys: |
${{ runner.os }}-php-
- name: PHP Lint
- name: PHP Lint in trunk/src/ directory
run: find trunk/src/ -name "*.php" -print0 | while IFS= read -r -d '' file; do php -l "$file" || exit 1; done

- name: PHP Lint trunk/config/ directory
run: find trunk/config/ -name "*.php" -print0 | while IFS= read -r -d '' file; do php -l "$file" || exit 1; done

- name: PHP Lint tests/ directory
run: find tests/ -name "*.php" -print0 | while IFS= read -r -d '' file; do php -l "$file" || exit 1; done

- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Execute tests (Smoking Tests and unit tests) via PHPUnit
run: vendor/bin/phpunit --bootstrap tests/bootstrap.php tests --testdox --coverage-text tests
run: vendor/bin/phpunit --testdox --coverage-text
24 changes: 24 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd" backupGlobals="false" colors="true"
bootstrap="tests/bootstrap.php">
<php>
<ini name="display_errors" value="1"/>
<ini name="error_reporting" value="-1"/>
<server name="SHELL_VERBOSITY" value="-1"/>
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<include>
<directory suffix=".php">trunk/src</directory>
</include>
<source>
<include>
<directory suffix=".php">trunk/src</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

${'display-metadata'} = $plugin_services['plugin'](base_dir: $plugin_dir, services: $plugin_services);

// Throw tests with vendor/bin/phpunit --bootstrap tests/bootstrap.php tests
// Throw tests with vendor/bin/phpunit --testdox

0 comments on commit c611a56

Please sign in to comment.