Skip to content

Commit 055de9c

Browse files
authored
Merge pull request #20 from pdsinterop/feature/phpunit-action
add dummy test + github action runner for phpunit
2 parents d9decf2 + a01f0db commit 055de9c

File tree

4 files changed

+89
-1
lines changed

4 files changed

+89
-1
lines changed

.github/workflows/tests.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
name: Test jobs
3+
4+
on:
5+
- push
6+
- pull_request
7+
# Allow manually triggering the workflow.
8+
- workflow_dispatch
9+
10+
# Cancels all previous workflow runs for the same branch that have not yet completed.
11+
concurrency:
12+
# The concurrency group contains the workflow name and the branch name.
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
phpunit:
18+
runs-on: ubuntu-20.04
19+
20+
strategy:
21+
matrix:
22+
php: ['8.0', '8.1']
23+
24+
steps:
25+
- uses: actions/checkout@v3
26+
- uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php }}
29+
- uses: "ramsey/composer-install@v2"
30+
with:
31+
composer-options: --no-scripts
32+
- run: bin/phpunit

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,8 @@
3636
"dev:example": "Run internal PHP development server with example code",
3737
"tests:unit": "Run unit-test with PHPUnit"
3838
},
39-
"type": "library"
39+
"type": "library",
40+
"require-dev": {
41+
"phpunit/phpunit": "^9"
42+
}
4043
}

phpunit.xml.dist

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
5+
6+
beStrictAboutCoversAnnotation="true"
7+
beStrictAboutOutputDuringTests="true"
8+
beStrictAboutTodoAnnotatedTests="true"
9+
bootstrap="vendor/autoload.php"
10+
cacheResultFile=".phpunit.cache/test-results"
11+
convertDeprecationsToExceptions="true"
12+
failOnRisky="true"
13+
failOnWarning="true"
14+
forceCoversAnnotation="true"
15+
verbose="true"
16+
>
17+
<testsuites>
18+
<testsuite name="all">
19+
<directory suffix=".php">tests/</directory>
20+
</testsuite>
21+
</testsuites>
22+
23+
<coverage processUncoveredFiles="false">
24+
<include>
25+
<directory suffix=".php">src/</directory>
26+
</include>
27+
<report>
28+
<!-- clover outputFile="build/clover.xml"/ -->
29+
<!-- html outputDirectory="build/coverage"/ -->
30+
<text outputFile="php://stdout"/>
31+
</report>
32+
</coverage>
33+
</phpunit>

tests/dummyTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/*
3+
This file is here as an example and to make sure the github actions runner has a test to run.
4+
It does not actually test anything.
5+
*/
6+
7+
namespace Pdsinterop\Dummy;
8+
9+
use PHPUnit\Framework\TestCase;
10+
11+
class DummyTest extends TestCase
12+
{
13+
/**
14+
* @coversNothing
15+
*/
16+
public function testDummy(): void
17+
{
18+
$this->assertTrue(true);
19+
}
20+
}

0 commit comments

Comments
 (0)