Skip to content

Commit

Permalink
add dummy test + github action runner for phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
ylebre committed Aug 26, 2022
1 parent d9decf2 commit a01f0db
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 1 deletion.
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -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
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
33 changes: 33 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"

beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
bootstrap="vendor/autoload.php"
cacheResultFile=".phpunit.cache/test-results"
convertDeprecationsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
forceCoversAnnotation="true"
verbose="true"
>
<testsuites>
<testsuite name="all">
<directory suffix=".php">tests/</directory>
</testsuite>
</testsuites>

<coverage processUncoveredFiles="false">
<include>
<directory suffix=".php">src/</directory>
</include>
<report>
<!-- clover outputFile="build/clover.xml"/ -->
<!-- html outputDirectory="build/coverage"/ -->
<text outputFile="php://stdout"/>
</report>
</coverage>
</phpunit>
20 changes: 20 additions & 0 deletions tests/dummyTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php
/*
This file is here as an example and to make sure the github actions runner has a test to run.
It does not actually test anything.
*/

namespace Pdsinterop\Dummy;

use PHPUnit\Framework\TestCase;

class DummyTest extends TestCase
{
/**
* @coversNothing
*/
public function testDummy(): void
{
$this->assertTrue(true);
}
}

0 comments on commit a01f0db

Please sign in to comment.