Skip to content

Commit 0f91b04

Browse files
committed
update test suite
* run on github * use github action to generate API docs * use phpunit 8 * run on php 8
1 parent fb4f888 commit 0f91b04

File tree

9 files changed

+64
-75
lines changed

9 files changed

+64
-75
lines changed

.github/workflows/apigen.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: ApiGen
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Unit Tests"]
6+
branches: [master]
7+
types:
8+
- completed
9+
10+
jobs:
11+
Document_Generator:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: 📝 ApiGen PHP Document Generator
16+
uses: varunsridharan/action-apigen@2.0
17+
with:
18+
cached_apigen: 'no'
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Unit Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
run:
7+
name: PHP ${{ matrix.php-versions }}
8+
runs-on: ubuntu-latest
9+
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
10+
11+
strategy:
12+
matrix:
13+
php-versions: ['7.2', '7.3', '7.4', '8.0']
14+
fail-fast: false
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
20+
- name: Setup PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: ${{ matrix.php-versions }}
24+
25+
- name: Setup problem matchers
26+
run: |
27+
echo ::add-matcher::${{ runner.tool_cache }}/php.json
28+
echo ::add-matcher::${{ runner.tool_cache }}/phpunit.json
29+
30+
- name: Setup Dependencies
31+
run: |
32+
composer update
33+
composer install
34+
- name: Run PHPUnit
35+
run: |
36+
./vendor/bin/phpunit --verbose

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ vendor/
55
composer.lock
66
apigen.phar
77
docs/
8-
8+
.phpunit.result.cache

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ It takes care of
1212

1313
It is lightweight and has **no 3rd party dependencies**. Note: this is for non-interactive scripts only. It has no readline or similar support.
1414

15-
[![Build Status](https://travis-ci.org/splitbrain/php-cli.svg)](https://travis-ci.org/splitbrain/php-cli)
16-
1715
## Installation
1816

1917
Use composer:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"psr/log": "Allows you to make the CLI available as PSR-3 logger"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "4.5.*"
27+
"phpunit/phpunit": "^8"
2828
},
2929
"autoload": {
3030
"psr-4": {

generate-api.sh

Lines changed: 0 additions & 63 deletions
This file was deleted.

phpunit.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77
convertNoticesToExceptions="true"
88
convertWarningsToExceptions="true"
99
processIsolation="false"
10-
stopOnFailure="false"
11-
syntaxCheck="false">
10+
stopOnFailure="false">
1211
<testsuites>
1312
<testsuite name="Test Suite">
1413
<directory suffix=".php">./tests/</directory>
1514
</testsuite>
1615
</testsuites>
17-
</phpunit>
16+
</phpunit>

tests/OptionsTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44

55
class Options extends \splitbrain\phpcli\Options
66
{
7-
87
public $args;
98
}
109

11-
class OptionsTest extends \PHPUnit_Framework_TestCase
10+
class OptionsTest extends \PHPUnit\Framework\TestCase
1211
{
1312

1413
/**
@@ -77,4 +76,4 @@ function test_complex()
7776
$this->assertTrue($options->getOpt('long'));
7877
$this->assertEquals(array('foo'), $options->args);
7978
}
80-
}
79+
}

tests/TableFormatterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function wordwrap($str, $width = 75, $break = "\n", $cut = false)
2323

2424
}
2525

26-
class TableFormatterTest extends \PHPUnit_Framework_TestCase
26+
class TableFormatterTest extends \PHPUnit\Framework\TestCase
2727
{
2828

2929
/**
@@ -138,4 +138,4 @@ public function test_onewrap()
138138
$result = $tf->format([5, '*'], [$col1, $col2]);
139139
$this->assertEquals($expect, $result);
140140
}
141-
}
141+
}

0 commit comments

Comments
 (0)