From 61a6072fd8e86569a419ace45b5685ee585deb01 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Tue, 9 Jul 2024 14:40:58 +0200 Subject: [PATCH] run tests using GitHub actions --- .github/workflows/unit-tests.yaml | 42 +++++++++++++++++++++++++++++++ Parsedown.php | 4 +-- composer.json | 2 +- test/CommonMarkTestStrict.php | 4 ++- 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/unit-tests.yaml diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml new file mode 100644 index 0000000..0232fba --- /dev/null +++ b/.github/workflows/unit-tests.yaml @@ -0,0 +1,42 @@ +on: + - push + - pull_request + +jobs: + phpunit: + runs-on: ubuntu-latest + + strategy: + matrix: + php: + - '5.3' + - '5.4' + - '5.5' + - '5.6' + - '7.0' + - '7.1' + - '7.2' + - '7.3' + - '7.4' + - '8.0' + - '8.1' + - '8.2' + - '8.3' + - '8.4' + + steps: + - name: Checkout the source code + uses: actions/checkout@v4 + + - name: Set up PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '${{ matrix.php }}' + + - name: Install dependencies + run: composer install + + - name: Run tests + run: | + vendor/bin/phpunit + vendor/bin/phpunit test/CommonMarkTestWeak.php || true diff --git a/Parsedown.php b/Parsedown.php index d9b5476..1b9d6d5 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -712,7 +712,7 @@ class Parsedown # # Setext - protected function blockSetextHeader($Line, ?array $Block = null) + protected function blockSetextHeader($Line, array $Block = null) { if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) { @@ -850,7 +850,7 @@ class Parsedown # # Table - protected function blockTable($Line, ?array $Block = null) + protected function blockTable($Line, array $Block = null) { if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted'])) { diff --git a/composer.json b/composer.json index f8b40f8..2d09c36 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "ext-mbstring": "*" }, "require-dev": { - "phpunit/phpunit": "^4.8.35" + "phpunit/phpunit": "^4.8|^5.7|^6.5|^7.5|^8.5|^9.6" }, "autoload": { "psr-0": {"Parsedown": ""} diff --git a/test/CommonMarkTestStrict.php b/test/CommonMarkTestStrict.php index 3837738..9a007e2 100644 --- a/test/CommonMarkTestStrict.php +++ b/test/CommonMarkTestStrict.php @@ -1,11 +1,13 @@