From a01f0db23d20da4776847eeb3a2e2cbc04ab33f7 Mon Sep 17 00:00:00 2001 From: Yvo Brevoort Date: Fri, 26 Aug 2022 15:48:56 +0200 Subject: [PATCH] add dummy test + github action runner for phpunit --- .github/workflows/tests.yml | 32 ++++++++++++++++++++++++++++++++ composer.json | 5 ++++- phpunit.xml.dist | 33 +++++++++++++++++++++++++++++++++ tests/dummyTest.php | 20 ++++++++++++++++++++ 4 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/tests.yml create mode 100644 phpunit.xml.dist create mode 100644 tests/dummyTest.php diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..50814af --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,32 @@ +--- +name: Test jobs + +on: + - push + - pull_request + # Allow manually triggering the workflow. + - workflow_dispatch + +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + phpunit: + runs-on: ubuntu-20.04 + + strategy: + matrix: + php: ['8.0', '8.1'] + + steps: + - uses: actions/checkout@v3 + - uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - uses: "ramsey/composer-install@v2" + with: + composer-options: --no-scripts + - run: bin/phpunit diff --git a/composer.json b/composer.json index e4a6855..a8233be 100644 --- a/composer.json +++ b/composer.json @@ -36,5 +36,8 @@ "dev:example": "Run internal PHP development server with example code", "tests:unit": "Run unit-test with PHPUnit" }, - "type": "library" + "type": "library", + "require-dev": { + "phpunit/phpunit": "^9" + } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..e1791a5 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,33 @@ + + + + + tests/ + + + + + + src/ + + + + + + + + \ No newline at end of file diff --git a/tests/dummyTest.php b/tests/dummyTest.php new file mode 100644 index 0000000..4f94796 --- /dev/null +++ b/tests/dummyTest.php @@ -0,0 +1,20 @@ +assertTrue(true); + } +} \ No newline at end of file