diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml new file mode 100644 index 000000000..c00148dfd --- /dev/null +++ b/.github/workflows/unit-tests.yaml @@ -0,0 +1,37 @@ +on: + - push + - pull_request + +jobs: + phpunit: + runs-on: ubuntu-latest + + strategy: + matrix: + php: + - '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/.gitignore b/.gitignore index d8a7996ab..47342dc5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ composer.lock vendor/ +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e1f556b1b..000000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: php - -matrix: - include: - - php: 5.3 - dist: precise - - php: 5.4 - dist: trusty - - php: 5.5 - dist: trusty - - php: 5.6 - dist: xenial - - php: 7.0 - dist: xenial - - php: 7.1 - dist: bionic - - php: 7.2 - dist: bionic - - php: 7.3 - dist: bionic - - php: 7.4 - dist: bionic - -install: - - composer install --prefer-dist --no-interaction --no-progress - -script: - - vendor/bin/phpunit - - vendor/bin/phpunit test/CommonMarkTestWeak.php || true - - '[ -z "$TRAVIS_TAG" ] || [ "$TRAVIS_TAG" == "$(php -r "require(\"Parsedown.php\"); echo Parsedown::version;")" ]' diff --git a/composer.json b/composer.json index f8b40f8ce..b145680a2 100644 --- a/composer.json +++ b/composer.json @@ -13,11 +13,11 @@ } ], "require": { - "php": ">=5.3.0", + "php": ">=7.1", "ext-mbstring": "*" }, "require-dev": { - "phpunit/phpunit": "^4.8.35" + "phpunit/phpunit": "^7.5|^8.5|^9.6" }, "autoload": { "psr-0": {"Parsedown": ""} diff --git a/test/CommonMarkTestStrict.php b/test/CommonMarkTestStrict.php index 3837738cb..4aa26dcfb 100644 --- a/test/CommonMarkTestStrict.php +++ b/test/CommonMarkTestStrict.php @@ -1,17 +1,19 @@ parsedown = new TestParsedown(); $this->parsedown->setUrlsLinked(false); diff --git a/test/CommonMarkTestWeak.php b/test/CommonMarkTestWeak.php index ef4081aa1..8d0bb4ab2 100644 --- a/test/CommonMarkTestWeak.php +++ b/test/CommonMarkTestWeak.php @@ -17,7 +17,7 @@ class CommonMarkTestWeak extends CommonMarkTestStrict { protected $textLevelElementRegex; - protected function setUp() + protected function setUp() : void { parent::setUp(); diff --git a/test/data/fenced_code_block.html b/test/data/fenced_code_block.html index 50d39df22..8ef93ae7e 100644 --- a/test/data/fenced_code_block.html +++ b/test/data/fenced_code_block.html @@ -15,4 +15,6 @@
foo
-bar
\ No newline at end of file
+bar
+<?php
+echo "Hello World";
\ No newline at end of file
diff --git a/test/data/fenced_code_block.md b/test/data/fenced_code_block.md
index 3e4155a88..81ca2bae9 100644
--- a/test/data/fenced_code_block.md
+++ b/test/data/fenced_code_block.md
@@ -35,4 +35,9 @@ foo
bar
+```
+
+```php some-class
+