Skip to content

Commit

Permalink
Merge dc55650 into 1700096
Browse files Browse the repository at this point in the history
  • Loading branch information
bkrukowski committed Jul 25, 2022
2 parents 1700096 + dc55650 commit 629e40b
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/.github export-ignore
/bin export-ignore
/dev-tools export-ignore
/tests export-ignore
/.coveralls.yml export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php_cs.dist export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
69 changes: 69 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: 'Tests'
on:
push:
tags:
- v*
branches:
- '**'
pull_request:

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-20.04']
php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug
env:
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Checkout
uses: actions/checkout@v2

- name: Setup composer.json
uses: php-actions/composer@v6
with:
command: config platform.php ${{ matrix.php-versions }}.99
php_version: 8.1
version: 1

- name: Install dependencies
uses: php-actions/composer@v6
with:
php_version: 7.1
version: 1

- name: Setup dev-tools/composer.json
if: startsWith(matrix.php-versions, '5.') || startsWith(matrix.php-versions, '7.')
uses: php-actions/composer@v6
with:
command: config platform.php ${{ matrix.php-versions }}.99
php_version: 7.1
version: 1

- name: Install dev-tools
if: startsWith(matrix.php-versions, '5.') || startsWith(matrix.php-versions, '7.')
uses: php-actions/composer@v6
with:
php_version: 7.1
args: --working-dir=dev-tools
version: 1

- name: Tests
run: vendor/bin/phpunit

- name: Coding Standards Fixer
if: startsWith(matrix.php-versions, '7.')
run: ./dev-tools/vendor/bin/php-cs-fixer --diff --dry-run -v --allow-risky=yes fix && ./dev-tools/vendor/bin/php-cs-fixer --diff --dry-run -v --allow-risky=yes fix .php_cs.dist

- name: Coverage
if: startsWith(matrix.php-versions, '5.') || startsWith(matrix.php-versions, '7.')
run: bin/coveralls.sh
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58 changes: 0 additions & 58 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2019-2020 Bartłomiej Krukowski
Copyright (c) 2019-2022 Bartłomiej Krukowski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"keywords": ["golang", "defer"],
"type": "library",
"require": {
"php": ">=5.3"
"php": "^5.3 || ^7.0 || ^8.0"
},
"require-dev": {
"awesomite/phpunit-4.8-fixer": "^1.0",
"phpunit/phpunit": "4.8.36"
"phpunit/phpunit": "4.8.36 || ^8.5 || ^9.5",
"symfony/phpunit-bridge": "*"
},
"license": "MIT",
"authors": [
Expand Down
3 changes: 2 additions & 1 deletion dev-tools/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"require": {
"php-coveralls/php-coveralls": "^1.1 || ^2.1"
"friendsofphp/php-cs-fixer": "2.16.1",
"php-coveralls/php-coveralls": "^2.5"
}
}
8 changes: 4 additions & 4 deletions tests/DeferTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public function testThrowExceptionInDefer()
EXPECTED;

$this->expectOutputString($expectedOutput);
$this->expectException(\get_class(new DeferException()));
$this->expectExceptionMessage('deferred');
$this->expectException_(\get_class(new DeferException()));
$this->expectExceptionMessage_('deferred');

defer($_, function () {
echo "throwing deferred exception\n";
Expand Down Expand Up @@ -93,8 +93,8 @@ public function testUnsetContext()
*/
public function testInvalidArgumentCallable($notCallable)
{
$this->expectException(\get_class(new \InvalidArgumentException()));
$this->expectExceptionMessage('Function defer expects argument $callable of type callable');
$this->expectException_(\get_class(new \InvalidArgumentException()));
$this->expectExceptionMessage_('Function defer expects argument $callable of type callable');
defer($_, $notCallable);
}

Expand Down
14 changes: 12 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,26 @@ abstract class TestCase extends BaseTestCase
/**
* @param string $class
*/
public function expectException($class)
public function expectException_($class)
{
if (\method_exists($this, 'expectException')) {
$this->expectException($class);

return;
}
$this->setProperty('expectedException', $class);
}

/**
* @param string $message
*/
public function expectExceptionMessage($message)
public function expectExceptionMessage_($message)
{
if (\method_exists($this, 'expectExceptionMessage')) {
$this->expectExceptionMessage($message);

return;
}
$this->setProperty('expectedExceptionMessage', $message);
}

Expand Down

0 comments on commit 629e40b

Please sign in to comment.