Skip to content

Commit 6377723

Browse files
Merge pull request #26 from assertwell/release/v0.2.1
Version 0.2.1
2 parents 6e847f2 + a28c743 commit 6377723

File tree

6 files changed

+25
-5
lines changed

6 files changed

+25
-5
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [Version 0.2.1] — 2021-04-15
8+
9+
* Mark tests that use `defineFunction()` or `deleteFunction()` as skipped if Runkit is unavailable ([#25])
10+
* Fix coding standards, remove unused namespace imports ([#22], props [@peter279k](https://github.com/peter279k))
11+
12+
713
## [Version 0.2.0] — 2020-11-23
814

915
* Introduce a [new `AssertWell\PHPUnitGlobalState\Functions` trait](docs/Functions.md) ([#17])
@@ -22,7 +28,10 @@ Initial public release of the package, with the following traits:
2228

2329
[Unreleased]: https://github.com/assertwell/phpunit-global-state/compare/master...develop
2430
[Version 0.1.0]: https://github.com/assertwell/phpunit-global-state/tag/v0.1.0
25-
[Version 0.2.0]: https://github.com/assertwell/phpunit-global-state/tag/v0.1.0
31+
[Version 0.2.0]: https://github.com/assertwell/phpunit-global-state/tag/v0.2.0
32+
[Version 0.2.1]: https://github.com/assertwell/phpunit-global-state/tag/v0.2.1
2633
[#15]: https://github.com/assertwell/phpunit-global-state/pull/15
2734
[#16]: https://github.com/assertwell/phpunit-global-state/pull/16
2835
[#17]: https://github.com/assertwell/phpunit-global-state/pull/17
36+
[#22]: https://github.com/assertwell/phpunit-global-state/pull/22
37+
[#25]: https://github.com/assertwell/phpunit-global-state/pull/25

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ parameters:
1515

1616
# Strings are a valid callable type.
1717
-
18-
message: '#Parameter \#1 \$function of function call_user_func_array expects callable\(\): mixed, string given\.#'
18+
message: '#Parameter \#1 \S+ of function call_user_func_array expects callable\(\): mixed, string given\.#'
1919
path: src/Support/Runkit.php
2020

2121
# Dynamically-defined functions.

src/Functions.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ protected function restoreFunctions()
5656
*/
5757
protected function defineFunction($name, \Closure $closure)
5858
{
59+
if (! Runkit::isAvailable()) {
60+
$this->markTestSkipped('defineFunction() requires Runkit be available, skipping.');
61+
}
62+
5963
if (function_exists($name)) {
6064
throw new FunctionExistsException(sprintf(
6165
'Function %1$s() already exists. You may redefine it using %2$s::redefineFunction() instead.',
@@ -130,6 +134,10 @@ protected function deleteFunction($name)
130134
return $this;
131135
}
132136

137+
if (! Runkit::isAvailable()) {
138+
$this->markTestSkipped('deleteFunction() requires Runkit be available, skipping.');
139+
}
140+
133141
$namespaced = Runkit::makeNamespaced($name);
134142

135143
if (! Runkit::function_rename($name, $namespaced)) {

tests/ConstantsTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use AssertWell\PHPUnitGlobalState\Exceptions\RedefineException;
66
use AssertWell\PHPUnitGlobalState\Support\Runkit;
7-
use PHPUnit\Framework\SkippedTestError;
87

98
/**
109
* @covers AssertWell\PHPUnitGlobalState\Constants

tests/FixtureTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace Tests;
44

5-
use AssertWell\PHPUnitGlobalState\Exceptions\RedefineException;
6-
use PHPUnit\Framework\SkippedTestError;
75
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
86

97
/**
@@ -15,6 +13,9 @@ class FixtureTest extends TestCase
1513
{
1614
use SetUpTearDownTrait;
1715

16+
/**
17+
* @var array<string>
18+
*/
1819
protected $backupGlobalsBlacklist = [
1920
'FIXTURE_BEFORE_GLOBAL',
2021
'FIXTURE_SETUP_GLOBAL',

tests/GlobalVariablesTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
*/
1010
class GlobalVariablesTest extends TestCase
1111
{
12+
/**
13+
* @var array<string>
14+
*/
1215
protected $backupGlobalsBlacklist = [
1316
'setGlobalVariable',
1417
];

0 commit comments

Comments
 (0)