Skip to content

Commit 224e080

Browse files
committed
Move to github actions
1 parent 3418ca7 commit 224e080

File tree

13 files changed

+361
-189
lines changed

13 files changed

+361
-189
lines changed

.githooks/pre-commit

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ if [ ! -x $PHP_CS_FIXER ]; then
1212
exit 1
1313
fi
1414

15-
if [ ! -x $PSALM ]; then
16-
echo ""
17-
echo "vimeo/psalm not found. Try:"
18-
echo ""
19-
echo " composer install"
20-
echo ""
21-
exit 1
22-
fi
15+
#if [ ! -x $PSALM ]; then
16+
# echo ""
17+
# echo "vimeo/psalm not found. Try:"
18+
# echo ""
19+
# echo " composer install"
20+
# echo ""
21+
# exit 1
22+
#fi
2323

2424
FILES=`git status --porcelain | grep -E '^[AM] +(src|tests).*\.php$' | cut -c 4- | tr '\n' ' '`
2525
if [ -z "$FILES" ]; then

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
time: "10:00"
8+
open-pull-requests-limit: 10

.github/workflows/tests.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
php-tests:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
fail-fast: true
10+
matrix:
11+
php: [8.0]
12+
dependency-version: [prefer-stable]
13+
os: [ubuntu-latest, windows-latest]
14+
15+
name: ${{ matrix.os }} - PHP${{ matrix.php }} - ${{ matrix.dependency-version }}
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
21+
- name: Cache dependencies
22+
uses: actions/cache@v2
23+
with:
24+
path: ~/.composer/cache/files
25+
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
26+
27+
- name: Setup PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: ${{ matrix.php }}
31+
extensions: dom, curl, libxml, mbstring, zip, intl
32+
coverage: none
33+
34+
- name: Install dependencies
35+
run: |
36+
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --ignore-platform-reqs
37+
38+
- name: Execute tests
39+
run: vendor/bin/phpunit
40+

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ vendor/
22
.idea/
33
bin/
44
composer.lock
5-
.php_cs.cache
5+
.php-cs-fixer.cache
66
.phpunit.result.cache
77
phpunit.xml

.php-cs-fixer.dist.php

Lines changed: 287 additions & 0 deletions
Large diffs are not rendered by default.

.php_cs.dist

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

.travis.yml

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

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PHPUnitSyntaxCoverage [![Build Status](https://api.travis-ci.com/phpfui/PHPUnitSyntaxCoverage.svg?branch=master)](https://travis-ci.com/github/phpfui/PHPUnitSyntaxCoverage) [![Latest Packagist release](https://img.shields.io/packagist/v/phpfui/phpunit-syntax-coverage.svg)](https://packagist.org/packages/phpfui/phpunit-syntax-coverage)
1+
# PHPUnitSyntaxCoverage [![Tests](https://github.com/phpfui/PHPUnitSyntaxCoverage/actions/workflows/tests.yml/badge.svg)](https://github.com/phpfui/PHPUnitSyntaxCoverage/actions?query=workflow%3Atests) [![Latest Packagist release](https://img.shields.io/packagist/v/phpfui/phpunit-syntax-coverage.svg)](https://packagist.org/packages/phpfui/phpunit-syntax-coverage)
22

33
## PHPUnit Extension for complete PHP Syntax Code Coverage
44

@@ -9,8 +9,7 @@ Often we accidently check in code with easily detectable syntax errors, but unle
99
PHPUnitSyntaxCoverage uses [PhpParser](https://github.com/nikic/PHP-Parser) to check for basic syntax errors. It then uses [ReflectionClass](https://www.php.net/manual/en/class.reflectionclass.php) to load any classes that are found in the source without instantiating them. This will find additional errors (such as missing or changed base classes from a package update).
1010

1111
# Requirements
12-
- PHP 7.1 or higher
13-
- PHPUnit 7 or higher
12+
- Modern versions of PHP and PHPUnit
1413
- Correctly configured autoloading
1514

1615
## Installation
@@ -70,4 +69,8 @@ Where X is one of the following **numbers**:
7069
See [examples](https://github.com/phpfui/PHPUnitSyntaxCoverage/blob/master/tests/UnitTest.php)
7170

7271
## Documentation
73-
Full documentation at [PHPFUI\PHPUnitSyntaxCoverage](http://phpfui.com/?p=d&n=PHPFUI%5CPHPUnitSyntaxCoverage)
72+
Via [PHPFUI/InstaDoc](http://phpfui.com/?n=PHPFUI\PHPUnitSyntaxCoverage)
73+
74+
## License
75+
PHPFUI is distributed under the MIT License.
76+

composer.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,18 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=7.3",
16-
"nikic/php-parser": ">=4.10"
15+
"php": "^7.3 | <8.1",
16+
"nikic/php-parser": "^4.13"
1717
},
1818
"autoload": {
1919
"psr-0": {
2020
"PHPFUI": "src/"
2121
}
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": ">=9.0",
24+
"phpunit/phpunit": ">=8.0",
2525
"roave/security-advisories": "dev-latest",
26-
"vimeo/psalm": "^4.7",
27-
"friendsofphp/php-cs-fixer": "^2.18",
28-
"symfony/translation-contracts": "^2.3"
26+
"friendsofphp/php-cs-fixer": "^3.0",
27+
"symfony/translation-contracts": ">=2.3"
2928
}
3029
}

src/PHPFUI/PHPUnitSyntaxCoverage/Extensions.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ public function assertValidPHPDirectory(string $directory, string $message = '',
154154
if ($recurseSubdirectories)
155155
{
156156
$iterator = new \RecursiveIteratorIterator(
157-
new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS),
158-
\RecursiveIteratorIterator::SELF_FIRST);
157+
new \RecursiveDirectoryIterator($directory, \RecursiveDirectoryIterator::SKIP_DOTS),
158+
\RecursiveIteratorIterator::SELF_FIRST
159+
);
159160
}
160161
else
161162
{
@@ -211,6 +212,7 @@ public function assertValidPHPFile(string $fileName, string $message = '') : voi
211212
if (! $this->skipNamespaceTest)
212213
{
213214
$namespace = $this->classFinder->getNamespace();
215+
214216
if (! \in_array($namespace, $this->skipNamespaces))
215217
{
216218
// assert namespace is correct

tests/badPHP/BadClass.php

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

55
class BadClass extends NoClass
66
{
7-
87
public function returnFloat() : float
98
{
109
return '3.14159265358979';
1110
}
12-
1311
}

tests/badPHP/BaseClass.php

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

55
class BaseClass
66
{
7-
87
public function returnFloat() : float
98
{
109
return 3.14159265358979;
1110
}
12-
1311
}

tests/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function classNameExists(string $className) : string
1414

1515
function autoload($className) : void
1616
{
17-
$path = classNameExists($className);
17+
$path = \classNameExists($className);
1818

1919
if ($path)
2020
{

0 commit comments

Comments
 (0)