Skip to content

Commit 6e847f2

Browse files
Merge pull request #19 from assertwell/release/v0.2.0
Version 0.2.0
2 parents 8775a0f + 859d3d3 commit 6e847f2

25 files changed

+1160
-204
lines changed

.github/workflows/unit-tests.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,43 @@ jobs:
2020

2121
- name: Configure PHP environment
2222
uses: shivammathur/setup-php@v2
23+
if: ${{ matrix.php >= '7.2' }}
2324
with:
2425
php-version: ${{ matrix.php }}
2526
tools: pecl
26-
extensions: runkit, runkit7-alpha
27+
extensions: runkit7-alpha
28+
env:
29+
fail-fast: true
30+
31+
- name: Configure PHP environment (PHP 7.1 only)
32+
uses: shivammathur/setup-php@v2
33+
if: ${{ matrix.php == '7.1' }}
34+
with:
35+
php-version: ${{ matrix.php }}
36+
tools: pecl
37+
extensions: runkit7-3.1.0a1
38+
env:
39+
fail-fast: true
40+
41+
# Version 2.x of runkit7 dropped PHP 7.0 support, but older releases are not available via PECL.
42+
# https://pecl.php.net/package/runkit7
43+
- name: Configure PHP environment (PHP 7.0 only)
44+
uses: shivammathur/setup-php@v2
45+
if: ${{ matrix.php == '7.0' }}
46+
with:
47+
php-version: ${{ matrix.php }}
48+
tools: pecl
49+
extensions: runkit7-1.0.11
50+
51+
- name: Configure PHP environment (PHP 5.x only)
52+
uses: shivammathur/setup-php@v2
53+
if: ${{ matrix.php <= '5.6' }}
54+
with:
55+
php-version: ${{ matrix.php }}
56+
tools: pecl
57+
extensions: runkit
58+
env:
59+
fail-fast: true
2760

2861
- name: Validate composer.json and composer.lock
2962
run: composer validate

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ 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-
## [Unreleased]
7+
## [Version 0.2.0] — 2020-11-23
8+
9+
* Introduce a [new `AssertWell\PHPUnitGlobalState\Functions` trait](docs/Functions.md) ([#17])
10+
* Introduce an `AssertWell\PHPUnitGlobalState\Support\Runkit` support class ([#15])
11+
* Simplify the cleanup between tests of of the private properties that hold changes ([#16])
12+
13+
14+
## [Version 0.1.0] — 2020-09-25
815

916
Initial public release of the package, with the following traits:
1017

@@ -14,3 +21,8 @@ Initial public release of the package, with the following traits:
1421

1522

1623
[Unreleased]: https://github.com/assertwell/phpunit-global-state/compare/master...develop
24+
[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
26+
[#15]: https://github.com/assertwell/phpunit-global-state/pull/15
27+
[#16]: https://github.com/assertwell/phpunit-global-state/pull/16
28+
[#17]: https://github.com/assertwell/phpunit-global-state/pull/17

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MyTestClass extends TestCase
3030

3131
### Introduction to Runkit
3232

33-
Some of the traits will rely on [Runkit7](https://www.php.net/runkit7), a port of PHP's runkit designed to work in PHP 7.x, to rewrite code at runtime (a.k.a. "monkey-patching").
33+
Some of the traits will rely on [Runkit7], a port of PHP's runkit designed to work in PHP 7.x, to rewrite code at runtime (a.k.a. "monkey-patching").
3434

3535
For example, once a PHP constant is defined, it will normally have that value until the PHP process ends. Under normal circumstances, that's great: it prevents the value from being accidentally overwritten and/or tampered with.
3636

@@ -46,7 +46,7 @@ var_dump(SOME_CONSTANT)
4646
#=> string(10) "some value"
4747

4848
// Now, re-define the constant.
49-
runkit_constant_redefine('SOME_CONSTANT', 'some other value');
49+
runkit7_constant_redefine('SOME_CONSTANT', 'some other value');
5050
var_dump(SOME_CONSTANT)
5151
#=> string(16) "some other value"
5252
```
@@ -57,11 +57,14 @@ Of course, we might want a constant's original value to be restored after our te
5757

5858
The library offers a number of traits, based on the type of global state that might need to be manipulated.
5959

60-
* [Constants](docs/Constants.md) (requires Runkit7)
60+
* [Constants](docs/Constants.md) (requires [Runkit7])
6161
* [Environment Variables](docs/EnvironmentVariables.md)
62+
* [Functions](docs/Functions.md) (requires [Runkit7])
6263
* [Global Variables](docs/GlobalVariables.md)
6364

6465

6566
## Contributing
6667

6768
If you're interested in contributing to the library, [please review our contributing guidelines](.github/CONTRIBUTING.md).
69+
70+
[Runkit7]: docs/Runkit.md

composer.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"phpcompatibility/php-compatibility": "^9.3",
2929
"phpstan/phpstan": "^0.12",
3030
"squizlabs/php_codesniffer": "^3.5",
31-
"stevegrunwell/runkit7-installer": "^1.1",
31+
"stevegrunwell/runkit7-installer": "^1.2",
3232
"symfony/phpunit-bridge": "^5.1"
3333
},
3434
"suggest": {
@@ -42,7 +42,10 @@
4242
"autoload-dev": {
4343
"psr-4": {
4444
"Tests\\": "tests/"
45-
}
45+
},
46+
"files": [
47+
"tests/stubs/functions.php"
48+
]
4649
},
4750
"config": {
4851
"preferred-install": "dist",
@@ -56,7 +59,8 @@
5659
"@test:analysis"
5760
],
5861
"test:analysis": [
59-
"phpstan analyse"
62+
"simple-phpunit --version",
63+
"phpstan analyse -c phpstan.neon.dist"
6064
],
6165
"test:coverage": [
6266
"phpdbg -qrr -d memory_limit=-1 ./vendor/bin/simple-phpunit --colors=always --testdox --coverage-html=tests/coverage"

composer.lock

Lines changed: 50 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/Constants.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,8 @@
22

33
Some applications — especially WordPress — will use [PHP constants](https://www.php.net/manual/en/language.constants.php) for configuration that should not be edited directly through the <abbr title="User Interface">UI</abbr>.
44

5-
Normally, a constant cannot be redefined or removed once defined; however, [the runkit7 extension](https://www.php.net/manual/en/book.runkit7) exposes functions to modify normally immutable constructs.
5+
Normally, a constant cannot be redefined or removed once defined; however, [the runkit7 extension](Runkit.md) exposes functions to modify normally immutable constructs.
66

7-
If runkit functions are unavailable, the `Constants` trait will automatically skip tests that rely on this functionality.
8-
9-
In order to install runkit7 in your development and CI environments, you may use [the installer bundled with this repo](https://github.com/stevegrunwell/runkit7-installer):
10-
11-
```sh
12-
$ sudo ./vendor/bin/install-runkit.sh
13-
```
147

158
## Methods
169

0 commit comments

Comments
 (0)