Compare commits

...

113 Commits

Author SHA1 Message Date
26b2e3561a docs: update changelog 2020-12-27 11:36:24 +00:00
60aea6798d Merge pull request #239 from gpibarra/patch-1
change binary path pest:dusk
2020-12-27 02:46:08 +01:00
fac3fe3f55 docs: updates changelog 2020-12-26 21:31:38 +01:00
17fac0a488 Update composer.json 2020-12-26 21:19:28 +01:00
6abc2207b2 change binary path pest:dusk
In windows not work
full path is used in [7e05b3ca4f/src/Console/DuskCommand.php (L91)) and [163d5c2bd8/src/Adapters/Laravel/Commands/TestCommand.php (L108))
2020-12-23 15:08:49 -03:00
885d224c5d docs: updates changelog 2020-12-20 17:22:40 +01:00
12441deab8 chore: upgrades version 2020-12-20 17:22:33 +01:00
8852fd14ce Merge pull request #236 from avrahamappel/master
Add test for inheritance with depends
2020-12-20 17:18:53 +01:00
e3814e6d9c chore: fixes static analsysis on uses_classs 2020-12-20 17:12:08 +01:00
e19eba0942 Rebuild snapshots 2020-12-17 23:24:29 -05:00
b6e2763731 Move dependency mapping to TestCase
The `TestCaseFactory::getClassName` was removed since it can have
unexpected results when called too early, as it builds up the test class
prematurely. It is not currently used anywhere else.
2020-12-17 23:24:11 -05:00
f75a3ee865 Add test for inheritance with depends 2020-12-15 22:29:37 -05:00
d707c2f208 Merge pull request #209 from NickSdot/make-root-path-working-in-subdirectory-structures
Get root path based on composer autoloader
2020-12-15 01:58:05 +01:00
a43b86d9eb chore: removes rector 2020-12-13 23:11:50 +01:00
5279d5e913 chore: pin expectations plugin version 2020-12-13 23:09:32 +01:00
df7fb92e03 chore: removes rector 2020-12-13 22:55:09 +01:00
95c3418313 docs: updates changelog 2020-12-13 22:52:06 +01:00
67a8be9347 chore: fixes snapshots 2020-12-13 22:50:13 +01:00
5d7f262f4a feat: removes expectation api for a plugin 2020-12-13 22:35:30 +01:00
23eebc8127 docs: updates changelog 2020-12-04 21:19:40 +01:00
3b435e460e chore: increases version 2020-12-04 21:19:32 +01:00
b52e9826e7 Merge pull request #234 from soilSpoon/feature/phpunit
Update PHPUnit dependency version
2020-12-04 09:16:27 +01:00
ba49dd0499 Update PHPUnit dependency version 2020-12-04 15:46:25 +09:00
f9f6f28950 Merge pull request #233 from misaert/feat-authorize-associative-array-for-with
fix: authorize string as key for datasets
2020-11-30 16:42:35 +01:00
f017015d1e fix: authorize string as key for datasets 2020-11-30 14:50:40 +01:00
29b4ee33bb Merge pull request #232 from pestphp/feat/expect-extend
feat: makes expect extendable
2020-11-29 18:25:21 +01:00
03dc11c2f6 Adds expect extend 2020-11-29 16:30:57 +01:00
b79ba5098b docs: updates changelog 2020-11-28 18:55:22 +01:00
3c418d82e6 chore: increases version 2020-11-28 18:55:14 +01:00
73ede2e344 Merge pull request #223 from clmntgr/support-pest-command
Add a dusk command for Laravel
2020-11-28 18:46:51 +01:00
266d891488 Merge pull request #231 from pestphp/feat/feedback-on-to-match
feat: adds key/value context when toMatchObject or toMatchArray fails
2020-11-28 18:21:52 +01:00
c71490b472 feat(feedback-on-to-match): uses contextual messages inside expectations 2020-11-27 21:52:44 +01:00
07705079e2 Merge pull request #229 from owenvoke/feature/release-guide
docs: add release guide
2020-11-27 11:42:46 +01:00
d88c268426 docs: use docs prefix in release commit message 2020-11-27 09:13:38 +00:00
a1b142e885 docs: add details on plugin versioning 2020-11-26 19:55:42 +00:00
a50d739e50 docs: add release guide 2020-11-26 19:55:11 +00:00
f82bb56d89 chore: update changelog 2020-11-24 09:12:43 +00:00
de593c3b93 Add a dusk command for Laravel.
This new command will replicate Dusk behavior with .env.dusk files
2020-11-24 10:07:06 +01:00
eedd5d80a0 chore: updates version 2020-11-23 22:01:06 +01:00
5bbdd4f41e docs: updates changelog 2020-11-23 21:43:58 +01:00
3fd24d96d3 feat: casts to array using toArray 2020-11-23 21:37:35 +01:00
7bea51fe09 feat: adds toMatchArray 2020-11-23 21:26:02 +01:00
cdf0a38145 Merge pull request #216 from owenvoke/bugfix/depends
fix(depends): resolve issue with dependency names
2020-11-23 08:43:58 +00:00
bb2474ccbe tests: add regression tests for depends 2020-11-13 11:14:17 +00:00
01143a6f84 fix(depends): resolve issue with dependency names 2020-11-13 11:08:35 +00:00
b93485c2ed Merge pull request #217 from owenvoke/feature/help
feat: add Pest options to help output
2020-11-12 14:59:50 +00:00
04681690b6 tests: update help snapshot to only include Pest options 2020-11-12 09:53:40 +00:00
200877d691 tests: update to use snapshot for help output 2020-11-12 09:44:26 +00:00
feb6417f45 tests: add visual test for help output 2020-11-12 09:11:51 +00:00
e7585a4ba2 tests: update snapshots 2020-11-12 09:03:44 +00:00
c33ab0f670 tests: add test for help output 2020-11-12 09:03:44 +00:00
78181f66f6 feat: add Pest options to help output 2020-11-12 09:03:43 +00:00
925636be61 docs: add missing bracket 2020-11-11 23:31:19 +00:00
6be131d602 chore: update changelog 2020-11-11 23:29:18 +00:00
f950f57eed Merge pull request #219 from owenvoke/feature/phpunit
chore(deps): add support for PHPUnit 9.4.3
2020-11-11 22:35:26 +00:00
c6369feaea chore(deps): add support for PHPUnit 9.4.3 2020-11-11 22:26:53 +00:00
1bdd3f4908 Update Pest.php 2020-11-09 10:56:14 +01:00
924e095dfc chore: updates changelog 2020-11-09 10:55:22 +01:00
72041a4a21 Merge pull request #215 from olivernybroe/teamcity-exception
Improve exception output in teamcity printer
2020-11-09 10:52:08 +01:00
d576446639 Improve exception output in teamcity printer 2020-11-04 09:17:57 +01:00
3fbec70ed3 chore: updates changelog 2020-11-01 23:22:18 +01:00
d177ab5ec2 feat: support to phpunit v9.4.2 2020-10-20 19:40:38 +02:00
ba08f2c11e Changes based on feedback https://github.com/pestphp/pest-intellij/issues/73#issuecomment-709201510 2020-10-15 19:46:16 +08:00
13a8aee049 Get root path from already available and correct path of autoloader 2020-10-14 21:31:28 +08:00
e4f5a284a6 Merge pull request #208 from owenvoke/bugfix/changelog-action
ci(changelog): fix changelog action
2020-10-13 11:16:15 +01:00
6671b266da ci(changelog): fix issue with branch and update to v3 2020-10-13 11:12:34 +01:00
3728bd8e0f ci(changelog): update formatting and run on change 2020-10-13 11:12:06 +01:00
c3616edbc8 docs: update changelog 2020-10-13 10:56:33 +01:00
21143b2693 Merge pull request #207 from fetzi/master
Update phpunit dependency constraint
2020-10-13 10:45:18 +01:00
006f9232cc Update phpunit dependency constraint
allow all versions greater 9.3.7

fixes #205
2020-10-13 11:24:25 +02:00
d1b61a34de Merge pull request #203 from olivernybroe/HelpCommand
Add Pest version to help command
2020-10-08 14:47:19 +02:00
896317ac97 Add Pest version to help command 2020-10-08 11:52:10 +02:00
4fd5c0edd4 Merge pull request #201 from octoper/changelog-action
Update Changelog action
2020-10-06 09:21:42 +02:00
e2c5d6d857 Update Changelog action to point to pestphp/docs 2020-10-06 08:36:41 +02:00
8057fe4bc2 Update Changelog Action 2020-10-06 08:10:57 +02:00
ebc9690301 Merge pull request #134 from sshead/adds-dataset-names
Add name to description for named datasets
2020-10-03 17:39:26 +02:00
049ce1845e chore: update changelog 2020-10-03 12:27:01 +01:00
faa6cd7deb Merge pull request #199 from owenvoke/feature/phpunit-9.4
feat: adds support to PHPUnit 9.4
2020-10-03 12:16:36 +01:00
1f9362c4e7 chore(composer): update to support PHPUnit 9.4 2020-10-02 11:18:10 +01:00
36fd18bcc8 Use Expectation API 2020-10-01 13:59:26 +10:00
aa352317cb Add a named dataset test to output to snapshot 2020-10-01 13:54:17 +10:00
edcd2cb50e Add name to description for named datasets 2020-10-01 13:23:23 +10:00
be8a64e4b8 Merge pull request #196 from DannyvdSluijs/feature-fix-skip-on-higher-order-test
Revert to original target if new target is null
2020-09-30 21:41:59 +02:00
2336bc0f65 Update snapshots 2020-09-30 21:36:05 +02:00
da82eecbae Add tests to ensure working. 2020-09-30 21:32:31 +02:00
4855987ba8 chore: update changelog 2020-09-30 13:03:23 +01:00
a493db1873 Revert to original target if new target is null 2020-09-29 21:51:28 +02:00
4f677a6cc2 Merge pull request #193 from owenvoke/feature/dependencies
chore(composer): add support for PHPUnit 9.3.11
2020-09-24 12:12:03 +01:00
228f2deb64 chore(composer): add support for PHPUnit 9.3.11 2020-09-24 10:45:19 +01:00
0fadf9a02c chore: update changelog 2020-09-21 20:31:32 +01:00
2b138ad76b Merge pull request #191 from owenvoke/feature/assert-regex
feat(expectations): add toMatch
2020-09-21 20:28:42 +01:00
e3e4815b55 chore(expectations): rename 'toMatchRegEx' to 'toMatch' 2020-09-21 20:20:21 +01:00
f76f353c32 chore: update snapshots 2020-09-21 20:19:01 +01:00
16b9f54dc3 feat(expectations): add toMatchRegEx 2020-09-21 20:18:58 +01:00
281166475e Merge pull request #190 from owenvoke/feature/assert-constraint
feat(expectations): add toMatchConstraint
2020-09-21 20:14:39 +01:00
23805cb5d6 chore: update snapshots 2020-09-16 19:03:21 +01:00
76d0f9cfc1 feat(expectations): add toMatchConstraint 2020-09-16 19:02:33 +01:00
5b083e4eb1 chore: update changelog 2020-09-16 10:35:43 +01:00
f48694b18a Merge pull request #187 from owenvoke/feature/assert-string
feat: add 'toStartWith' and 'toEndWith' expectations
2020-09-16 10:33:00 +01:00
8fa59ddbf0 Merge pull request #189 from owenvoke/feature/changelog-workflow
chore: don't run changelog workflow on forks
2020-09-16 09:26:17 +01:00
2619db4026 chore: don't run changelog workflow on forks 2020-09-16 08:26:49 +01:00
f3a71fb100 chore: update snapshots 2020-09-16 08:22:35 +01:00
04fafe742c feat(expectations): add toEndWith 2020-09-16 08:21:46 +01:00
cad8a41e6d feat(expectations): add toStartWith 2020-09-16 08:20:00 +01:00
1567923cda docs: updates changelog 2020-09-15 21:57:50 +02:00
c7116afcae tests: updates snapshots 2020-09-15 21:56:39 +02:00
4e184b2f90 Adds toMatchObject 2020-09-15 21:53:25 +02:00
9b5f664f00 Merge pull request #185 from owenvoke/feature/stubs
chore: update PHPUnit config stubs
2020-09-15 13:06:33 +02:00
0e89525ea8 chore: fix PHPUnit config 2020-09-15 10:45:17 +01:00
0b6cdf8f02 chore: fix PHPUnit config stubs 2020-09-15 10:44:59 +01:00
5f63d959e1 docs: updates changelog 2020-09-13 15:35:49 +02:00
be7fe41179 docs: updates changelog 2020-09-13 15:16:38 +02:00
204f343831 feat: adds toHaveKeys expectation 2020-09-13 15:15:37 +02:00
75 changed files with 405 additions and 1499 deletions

View File

@ -5,6 +5,7 @@ on:
branches: [ master ]
paths:
- CHANGELOG.md
- .github/workflows/changelog.yml
pull_request:
branches: [ master ]
paths:
@ -13,19 +14,25 @@ jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'pestphp/pest'
steps:
- uses: actions/checkout@v2
- name: Checkout website repository
uses: actions/checkout@v2
with:
token: ${{ secrets.CHANGELOG_KEY }}
repository: pestphp/website
path: pestphp-website
repository: pestphp/docs
path: pestphp-docs
ref: master
- name: Read CHANGELOG.md
id: package
uses: juliangruber/read-file-action@v1
with:
path: ./CHANGELOG.md
- name: Add file headers
uses: DamianReeves/write-file-action@v1.0
with:
@ -34,8 +41,6 @@ jobs:
---
title: Changelog
description: Changelog
extends: _layouts.documentation
section: content
---
${{ steps.package.outputs.content }}
@ -43,14 +48,16 @@ jobs:
Next section: [Upgrade Guide →](/docs/upgrade-guide)
write-mode: overwrite
- name: Copy CHANGELOG to website repository
run: cp CHANGELOG.md pestphp-website/source/docs/changelog.md
run: cp CHANGELOG.md pestphp-docs/changelog.md
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.CHANGELOG_KEY }}
commit-message: Update changelog.md
committer: GitHub Action <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
title: 'Update changelog.md'
path: ./pestphp-website
path: ./pestphp-docs

View File

@ -22,9 +22,6 @@ jobs:
- name: Install Dependencies
run: composer update --no-interaction --no-progress
- name: Run Rector
run: vendor/bin/rector process src --dry-run
- name: Run PHP-CS-Fixer
run: vendor/bin/php-cs-fixer fix -v --allow-risky=yes --dry-run

View File

@ -4,7 +4,88 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
## [v0.3.19 (2020-12-27)](https://github.com/pestphp/pest/compare/v0.3.18...v0.3.19)
### Fixed
- Fix binary path in `pest:dusk` command ([#239](https://github.com/pestphp/pest/pull/239))
## [v0.3.18 (2020-12-26)](https://github.com/pestphp/pest/compare/v0.3.17...v0.3.18)
### Added
- `toBeJson()` expectation ([plugin-expectations#2](https://github.com/pestphp/pest-plugin-expectations/pull/2))
## [v0.3.17 (2020-12-20)](https://github.com/pestphp/pest/compare/v0.3.16...v0.3.17)
### Fixed
- Class inheritance with `depends()` ([#236](https://github.com/pestphp/pest/pull/236))
## [v0.3.16 (2020-12-13)](https://github.com/pestphp/pest/compare/v0.3.15...v0.3.16)
### Changed
- Moves expectation API for external plugin ([5d7f262](https://github.com/pestphp/pest/commit/5d7f262f4ab280a660a85900f402eebb23abfda8))
## [v0.3.15 (2020-12-04)](https://github.com/pestphp/pest/compare/v0.3.14...v0.3.15)
### Added
- Support for PHPUnit 9.5.0 ([#234](https://github.com/pestphp/pest/pull/234))
- Support for extending expectation API ([#232](https://github.com/pestphp/pest/pull/232))
### Fixed
- Static analysis while using string as key for datasets ([#233](https://github.com/pestphp/pest/pull/233))
## [v0.3.14 (2020-11-28)](https://github.com/pestphp/pest/compare/v0.3.13...v0.3.14)
### Added
- `pest:dusk` command ([#223](https://github.com/pestphp/pest/pull/223))
- Better feedback on errors in `toMatchArray` and `toMatchObject` ([#231](https://github.com/pestphp/pest/pull/231))
## [v0.3.13 (2020-11-23)](https://github.com/pestphp/pest/compare/v0.3.12...v0.3.13)
### Added
- `toMatchArray` expectation ([7bea51f](https://github.com/pestphp/pest/commit/7bea51fe09dd2eca7093e4c34cf2dab2e8d39fa5), [3fd24d9](https://github.com/pestphp/pest/commit/3fd24d96d3145dcebdb0aab40aa8b76faa8b6979))
- Add Pest options to `--help` output ([#217](https://github.com/pestphp/pest/pull/217))
### Fixed
- Resolve issue with name resolution in `depends()` ([#216](https://github.com/pestphp/pest/pull/216))
## [v0.3.12 (2020-11-11)](https://github.com/pestphp/pest/compare/v0.3.11...v0.3.12)
### Added
- Add support for PHPUnit 9.4.3 ([#219](https://github.com/pestphp/pest/pull/219))
## [v0.3.11 (2020-11-09)](https://github.com/pestphp/pest/compare/v0.3.10...v0.3.11)
### Changed
- Improved the exception output for the TeamCity printer (usage with phpstorm plugin) ([#215](https://github.com/pestphp/pest/pull/215))
## [v0.3.10 (2020-11-01)](https://github.com/pestphp/pest/compare/v0.3.9...v0.3.10)
### Added
- Add support for PHPUnit 9.4.2 ([d177ab5](https://github.com/pestphp/pest/commit/d177ab5ec2030c5bb8e418d10834c370c94c433d))
## [v0.3.9 (2020-10-13)](https://github.com/pestphp/pest/compare/v0.3.8...v0.3.9)
### Added
- Add support for named datasets in description output ([#134](https://github.com/pestphp/pest/pull/134))
- Add Pest version to `--help` output ([#203](https://github.com/pestphp/pest/pull/203))
- Add support for PHPUnit 9.4.1 ([#207](https://github.com/pestphp/pest/pull/207))
## [v0.3.8 (2020-10-03)](https://github.com/pestphp/pest/compare/v0.3.7...v0.3.8)
### Added
- Add support for PHPUnit 9.4.0 ([#199](https://github.com/pestphp/pest/pull/199))
### Fixed
- Fix chained higher order assertions returning void ([#196](https://github.com/pestphp/pest/pull/196))
## [v0.3.7 (2020-09-30)](https://github.com/pestphp/pest/compare/v0.3.6...v0.3.7)
### Added
- Add support for PHPUnit 9.3.11 ([#193](https://github.com/pestphp/pest/pull/193))
## [v0.3.6 (2020-09-21)](https://github.com/pestphp/pest/compare/v0.3.5...v0.3.6)
### Added
- `toMatch` expectation ([#191](https://github.com/pestphp/pest/pull/191))
- `toMatchConstraint` expectation ([#190](https://github.com/pestphp/pest/pull/190))
## [v0.3.5 (2020-09-16)](https://github.com/pestphp/pest/compare/v0.3.4...v0.3.5)
### Added
- `toStartWith` and `toEndWith` expectations ([#187](https://github.com/pestphp/pest/pull/187))
## [v0.3.4 (2020-09-15)](https://github.com/pestphp/pest/compare/v0.3.3...v0.3.4)
### Added
- `toMatchObject` expectation ([4e184b2](https://github.com/pestphp/pest/commit/4e184b2f906c318a5e9cd38fe693cdab5c48d8a2))
## [v0.3.3 (2020-09-13)](https://github.com/pestphp/pest/compare/v0.3.2...v0.3.3)
### Added
- `toHaveKeys` expectation ([204f343](https://github.com/pestphp/pest/commit/204f343831adc17bb3734553c24fac92d02f27c7))
## [v0.3.2 (2020-09-12)](https://github.com/pestphp/pest/compare/v0.3.1...v0.3.2)
### Added

16
RELEASE.md Normal file
View File

@ -0,0 +1,16 @@
# Release process
When releasing a new version of Pest there are some checks and updates that need to be done:
- Clear your local repository with: `git add . && git reset --hard && git checkout master`
- On the GitHub repository, check the contents of [github.com/pestphp/pest/compare/{latest_version}...master](https://github.com/pestphp/pest/compare/{latest_version}...master) and update the [changelog](CHANGELOG.md) file with the main changes for this release
- Update the version number in [src/Pest.php](src/Pest.php)
- Run the tests locally using: `composer test`
- Commit the CHANGELOG and Pest file with the message: `git commit -m "docs: update changelog"`
- Push the changes to GitHub
- Check that the CI is passing as expected: [github.com/pestphp/pest/actions](https://github.com/pestphp/pest/actions)
- Tag and push the tag with `git tag vX.X.X && git push --tags`
### Plugins
Plugins should be versioned using the same major (or minor for `0.x` releases) version as Pest core.

View File

@ -19,13 +19,16 @@ use Symfony\Component\Console\Output\OutputInterface;
if (file_exists($vendorPath)) {
include_once $vendorPath;
$autoloadPath = $vendorPath;
} else {
include_once $localPath;
$autoloadPath = $localPath;
}
(new Provider())->register();
$rootPath = getcwd();
// get $rootPath based on $autoloadPath
$rootPath = dirname($autoloadPath, 2);
$testSuite = TestSuite::getInstance($rootPath);

View File

@ -21,15 +21,16 @@
"nunomaduro/collision": "^5.0",
"pestphp/pest-plugin": "^0.3",
"pestphp/pest-plugin-coverage": "^0.3",
"pestphp/pest-plugin-expectations": "^0.3.3",
"pestphp/pest-plugin-init": "^0.3",
"phpunit/phpunit": "9.3.7 || 9.3.8 || 9.3.9 || 9.3.10"
"phpunit/phpunit": ">= 9.3.7 <= 9.5.0"
},
"autoload": {
"psr-4": {
"Pest\\": "src/"
},
"files": [
"src/globals.php",
"src/Functions.php",
"src/Pest.php"
]
},
@ -44,6 +45,7 @@
"require-dev": {
"illuminate/console": "^7.16.1",
"illuminate/support": "^7.16.1",
"laravel/dusk": "^6.9.1",
"mockery/mockery": "^1.4.1",
"pestphp/pest-dev-tools": "dev-master"
},
@ -57,8 +59,8 @@
"bin/pest"
],
"scripts": {
"lint": "rector process src && php-cs-fixer fix -v",
"test:lint": "php-cs-fixer fix -v --dry-run && rector process src --dry-run",
"lint": "php-cs-fixer fix -v",
"test:lint": "php-cs-fixer fix -v --dry-run",
"test:types": "phpstan analyse --ansi --memory-limit=0",
"test:unit": "php bin/pest --colors=always --exclude-group=integration",
"test:integration": "php bin/pest --colors=always --group=integration",
@ -72,7 +74,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "0.4.x-dev"
"dev-master": "0.3.x-dev"
},
"pest": {
"plugins": [

View File

@ -7,14 +7,13 @@ parameters:
level: max
paths:
- src
excludes_analyse:
- src/globals.php
checkMissingIterableValueType: true
checkGenericClassInNonGenericObjectType: false
reportUnmatchedIgnoredErrors: true
ignoreErrors:
- "#type mixed is not subtype of native#"
- "#Undefined variable: \\$this#"
- "#is not allowed to extend#"
- "#Language construct eval#"

View File

@ -8,8 +8,8 @@
<directory suffix=".php">./tests</directory>
</testsuite>
</testsuites>
<coverage>
<include processUncoveredFiles="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>

View File

@ -1,35 +0,0 @@
<?php
declare(strict_types=1);
use Rector\Core\Configuration\Option;
use Rector\Php70\Rector\StaticCall\StaticCallOnNonStaticToInstanceCallRector;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
return static function (ContainerConfigurator $containerConfigurator): void {
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::AUTO_IMPORT_NAMES, true);
$parameters->set(Option::SETS, [
SetList::ACTION_INJECTION_TO_CONSTRUCTOR_INJECTION,
SetList::ARRAY_STR_FUNCTIONS_TO_STATIC_CALL,
SetList::CODE_QUALITY,
SetList::PHP_53,
SetList::PHP_54,
SetList::PHP_56,
SetList::PHP_70,
SetList::PHP_71,
SetList::PHP_72,
SetList::PHP_73,
SetList::PHPSTAN,
SetList::PHPUNIT_CODE_QUALITY,
SetList::SOLID,
]);
$parameters->set(Option::PATHS, [__DIR__ . '/src', __DIR__ . '/tests']);
$parameters->set(Option::EXCLUDE_RECTORS, [
StaticCallOnNonStaticToInstanceCallRector::class,
]);
};

View File

@ -21,6 +21,7 @@ final class LoadStructure
* @var array<int, string>
*/
private const STRUCTURE = [
'Expectations.php',
'Datasets.php',
'Helpers.php',
'Pest.php',

View File

@ -5,9 +5,9 @@ declare(strict_types=1);
namespace Pest\Concerns;
use Closure;
use Pest\Expectation;
use Pest\Support\ExceptionTrace;
use Pest\TestSuite;
use PHPUnit\Framework\ExecutionOrderDependency;
use PHPUnit\Util\Test;
use Throwable;
@ -55,6 +55,24 @@ trait TestCase
$this->setGroups($groups);
}
/**
* Add dependencies to the test case and map them to instances of ExecutionOrderDependency.
*/
public function addDependencies(array $tests): void
{
$className = get_class($this);
$tests = array_map(function (string $test) use ($className): ExecutionOrderDependency {
if (strpos($test, '::') === false) {
$test = "{$className}::{$test}";
}
return new ExecutionOrderDependency($test, null, '');
}, $tests);
$this->setDependencies($tests);
}
/**
* Returns the test case name. Note that, in Pest
* we ignore withDataset argument as the description
@ -94,16 +112,6 @@ trait TestCase
parent::tearDownAfterClass();
}
/**
* Creates a new expectation.
*
* @param mixed $value
*/
public function expect($value): Expectation
{
return new Expectation($value);
}
/**
* Gets executed before the test.
*/

View File

@ -11,6 +11,8 @@ use Pest\Actions\ValidatesConfiguration;
use Pest\Contracts\Plugins\AddsOutput;
use Pest\Contracts\Plugins\HandlesArguments;
use Pest\Plugin\Loader;
use Pest\Plugins\Version;
use Pest\Support\Container;
use Pest\TestSuite;
use PHPUnit\Framework\TestSuite as BaseTestSuite;
use PHPUnit\TextUI\Command as BaseCommand;
@ -139,4 +141,14 @@ final class Command extends BaseCommand
exit($result);
}
protected function showHelp(): void
{
/** @var Version $version */
$version = Container::getInstance()->get(Version::class);
$version->handleArguments(['--version']);
parent::showHelp();
(new Help($this->output))();
}
}

37
src/Console/Help.php Normal file
View File

@ -0,0 +1,37 @@
<?php
declare(strict_types=1);
namespace Pest\Console;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @internal
*/
final class Help
{
/** @var array<int, string> */
private const HELP_MESSAGES = [
'<comment>Pest Options:</comment>',
' <info>--init</info> Initialise a standard Pest configuration',
' <info>--coverage</info> Enable coverage and output to standard output',
' <info>--min=<fg=cyan><N></></info> Set the minimum required coverage percentage (<N>), and fail if not met',
' <info>--group=<fg=cyan><name></></info> Only runs tests from the specified group(s)',
];
/** @var OutputInterface */
private $output;
public function __construct(OutputInterface $output)
{
$this->output = $output;
}
public function __invoke(): void
{
foreach (self::HELP_MESSAGES as $message) {
$this->output->writeln($message);
}
}
}

View File

@ -18,14 +18,14 @@ final class Datasets
/**
* Holds the datasets.
*
* @var array<string, \Closure|iterable<int, mixed>>
* @var array<int|string, Closure|iterable<int|string, mixed>>
*/
private static $datasets = [];
/**
* Sets the given.
*
* @param Closure|iterable<int, mixed> $data
* @param Closure|iterable<int|string, mixed> $data
*/
public static function set(string $name, $data): void
{
@ -37,7 +37,7 @@ final class Datasets
}
/**
* @return Closure|iterable<int, mixed>
* @return Closure|iterable<int|string, mixed>
*/
public static function get(string $name)
{
@ -51,7 +51,7 @@ final class Datasets
/**
* Resolves the current dataset to an array value.
*
* @param Traversable<int, mixed>|Closure|iterable<int, mixed>|string|null $data
* @param Traversable<int|string, mixed>|Closure|iterable<int|string, mixed>|string|null $data
*
* @return array<string, mixed>
*/
@ -77,10 +77,10 @@ final class Datasets
$dataSetDescriptions = [];
$dataSetValues = [];
foreach ($data as $values) {
foreach ($data as $key => $values) {
$values = is_array($values) ? $values : [$values];
$dataSetDescriptions[] = $description . self::getDataSetDescription($values);
$dataSetDescriptions[] = $description . self::getDataSetDescription($key, $values);
$dataSetValues[] = $values;
}
@ -104,12 +104,15 @@ final class Datasets
}
/**
* @param int|string $key
* @param array<int, mixed> $data
*/
private static function getDataSetDescription(array $data): string
private static function getDataSetDescription($key, array $data): string
{
$exporter = new Exporter();
return \sprintf(' with (%s)', $exporter->shortenedRecursiveExport($data));
$nameInsert = is_string($key) ? \sprintf('data set "%s" ', $key) : '';
return \sprintf(' with %s(%s)', $nameInsert, $exporter->shortenedRecursiveExport($data));
}
}

View File

@ -1,457 +0,0 @@
<?php
declare(strict_types=1);
namespace Pest;
use PHPUnit\Framework\Assert;
/**
* @internal
*
* @property Expectation $not Creates the opposite expectation.
*/
final class Expectation
{
/**
* The expectation value.
*
* @readonly
*
* @var mixed
*/
public $value;
/**
* Creates a new expectation.
*
* @param mixed $value
*/
public function __construct($value)
{
$this->value = $value;
}
/**
* Creates a new expectation.
*
* @param mixed $value
*/
public function and($value): Expectation
{
return new self($value);
}
/**
* Creates the opposite expectation for the value.
*/
public function not(): OppositeExpectation
{
return new OppositeExpectation($this);
}
/**
* Asserts that two variables have the same type and
* value. Used on objects, it asserts that two
* variables reference the same object.
*
* @param mixed $expected
*/
public function toBe($expected): Expectation
{
Assert::assertSame($expected, $this->value);
return $this;
}
/**
* Asserts that the value is empty.
*/
public function toBeEmpty(): Expectation
{
Assert::assertEmpty($this->value);
return $this;
}
/**
* Asserts that the value is true.
*/
public function toBeTrue(): Expectation
{
Assert::assertTrue($this->value);
return $this;
}
/**
* Asserts that the value is false.
*/
public function toBeFalse(): Expectation
{
Assert::assertFalse($this->value);
return $this;
}
/**
* Asserts that the value is greater than $expected.
*
* @param int|float $expected
*/
public function toBeGreaterThan($expected): Expectation
{
Assert::assertGreaterThan($expected, $this->value);
return $this;
}
/**
* Asserts that the value is greater than or equal to $expected.
*
* @param int|float $expected
*/
public function toBeGreaterThanOrEqual($expected): Expectation
{
Assert::assertGreaterThanOrEqual($expected, $this->value);
return $this;
}
/**
* Asserts that the value is less than or equal to $expected.
*
* @param int|float $expected
*/
public function toBeLessThan($expected): Expectation
{
Assert::assertLessThan($expected, $this->value);
return $this;
}
/**
* Asserts that the value is less than $expected.
*
* @param int|float $expected
*/
public function toBeLessThanOrEqual($expected): Expectation
{
Assert::assertLessThanOrEqual($expected, $this->value);
return $this;
}
/**
* Asserts that $needle is an element of the value.
*
* @param mixed $needle
*/
public function toContain($needle): Expectation
{
if (is_string($this->value)) {
Assert::assertStringContainsString($needle, $this->value);
} else {
Assert::assertContains($needle, $this->value);
}
return $this;
}
/**
* Asserts that $count matches the number of elements of the value.
*/
public function toHaveCount(int $count): Expectation
{
Assert::assertCount($count, $this->value);
return $this;
}
/**
* Asserts that the value contains the property $name.
*/
public function toHaveProperty(string $name): Expectation
{
Assert::assertTrue(property_exists($this->value, $name));
return $this;
}
/**
* Asserts that two variables have the same value.
*
* @param mixed $expected
*/
public function toEqual($expected): Expectation
{
Assert::assertEquals($expected, $this->value);
return $this;
}
/**
* Asserts that two variables have the same value.
* The contents of $expected and the $this->value are
* canonicalized before they are compared. For instance, when the two
* variables $expected and $this->value are arrays, then these arrays
* are sorted before they are compared. When $expected and $this->value
* are objects, each object is converted to an array containing all
* private, protected and public attributes.
*
* @param mixed $expected
*/
public function toEqualCanonicalizing($expected): Expectation
{
Assert::assertEqualsCanonicalizing($expected, $this->value);
return $this;
}
/**
* Asserts that the absolute difference between the value and $expected
* is lower than $delta.
*
* @param mixed $expected
*/
public function toEqualWithDelta($expected, float $delta): Expectation
{
Assert::assertEqualsWithDelta($expected, $this->value, $delta);
return $this;
}
/**
* Asserts that the value is infinite.
*/
public function toBeInfinite(): Expectation
{
Assert::assertInfinite($this->value);
return $this;
}
/**
* Asserts that the value is an instance of $class.
*
* @param string $class
*/
public function toBeInstanceOf($class): Expectation
{
/* @phpstan-ignore-next-line */
Assert::assertInstanceOf($class, $this->value);
return $this;
}
/**
* Asserts that the value is an array.
*/
public function toBeArray(): Expectation
{
Assert::assertIsArray($this->value);
return $this;
}
/**
* Asserts that the value is of type bool.
*/
public function toBeBool(): Expectation
{
Assert::assertIsBool($this->value);
return $this;
}
/**
* Asserts that the value is of type callable.
*/
public function toBeCallable(): Expectation
{
Assert::assertIsCallable($this->value);
return $this;
}
/**
* Asserts that the value is of type float.
*/
public function toBeFloat(): Expectation
{
Assert::assertIsFloat($this->value);
return $this;
}
/**
* Asserts that the value is of type int.
*/
public function toBeInt(): Expectation
{
Assert::assertIsInt($this->value);
return $this;
}
/**
* Asserts that the value is of type iterable.
*/
public function toBeIterable(): Expectation
{
Assert::assertIsIterable($this->value);
return $this;
}
/**
* Asserts that the value is of type numeric.
*/
public function toBeNumeric(): Expectation
{
Assert::assertIsNumeric($this->value);
return $this;
}
/**
* Asserts that the value is of type object.
*/
public function toBeObject(): Expectation
{
Assert::assertIsObject($this->value);
return $this;
}
/**
* Asserts that the value is of type resource.
*/
public function toBeResource(): Expectation
{
Assert::assertIsResource($this->value);
return $this;
}
/**
* Asserts that the value is of type scalar.
*/
public function toBeScalar(): Expectation
{
Assert::assertIsScalar($this->value);
return $this;
}
/**
* Asserts that the value is of type string.
*/
public function toBeString(): Expectation
{
Assert::assertIsString($this->value);
return $this;
}
/**
* Asserts that the value is NAN.
*/
public function toBeNan(): Expectation
{
Assert::assertNan($this->value);
return $this;
}
/**
* Asserts that the value is null.
*/
public function toBeNull(): Expectation
{
Assert::assertNull($this->value);
return $this;
}
/**
* Asserts that the value array has the provided $key.
*/
public function toHaveKey(string $key): Expectation
{
Assert::assertArrayHasKey($key, $this->value);
return $this;
}
/**
* Asserts that the value is a directory.
*/
public function toBeDirectory(): Expectation
{
Assert::assertDirectoryExists($this->value);
return $this;
}
/**
* Asserts that the value is a directory and is readable.
*/
public function toBeReadableDirectory(): Expectation
{
Assert::assertDirectoryIsReadable($this->value);
return $this;
}
/**
* Asserts that the value is a directory and is writable.
*/
public function toBeWritableDirectory(): Expectation
{
Assert::assertDirectoryIsWritable($this->value);
return $this;
}
/**
* Asserts that the value is a file.
*/
public function toBeFile(): Expectation
{
Assert::assertFileExists($this->value);
return $this;
}
/**
* Asserts that the value is a file and is readable.
*/
public function toBeReadableFile(): Expectation
{
Assert::assertFileIsReadable($this->value);
return $this;
}
/**
* Asserts that the value is a file and is writable.
*/
public function toBeWritableFile(): Expectation
{
Assert::assertFileIsWritable($this->value);
return $this;
}
/**
* Dynamically calls methods on the class without any arguments.
*
* @return Expectation
*/
public function __get(string $name)
{
/* @phpstan-ignore-next-line */
return $this->{$name}();
}
}

View File

@ -59,7 +59,7 @@ final class TestCaseFactory
/**
* Holds the dataset, if any.
*
* @var Closure|iterable<int, mixed>|string|null
* @var Closure|iterable<int|string, mixed>|string|null
*/
public $dataset;
@ -156,14 +156,6 @@ final class TestCaseFactory
return array_map($createTest, array_keys($datasets), $datasets);
}
/**
* Makes a fully qualified class name from the current filename.
*/
public function getClassName(): string
{
return $this->makeClassFromFilename($this->filename);
}
/**
* Makes a fully qualified class name from the given filename.
*/

View File

@ -3,7 +3,6 @@
declare(strict_types=1);
use Pest\Datasets;
use Pest\Expectation;
use Pest\PendingObjects\AfterEachCall;
use Pest\PendingObjects\BeforeEachCall;
use Pest\PendingObjects\TestCall;
@ -36,7 +35,7 @@ function beforeEach(Closure $closure = null): BeforeEachCall
/**
* Registers the given dataset.
*
* @param Closure|iterable $dataset
* @param Closure|iterable<int|string, mixed> $dataset
*/
function dataset(string $name, $dataset): void
{
@ -63,7 +62,7 @@ function uses(string ...$classAndTraits): UsesCall
*/
function test(string $description = null, Closure $closure = null)
{
if ($description === null && TestSuite::getInstance()->test) {
if ($description === null && TestSuite::getInstance()->test !== null) {
return new HigherOrderTapProxy(TestSuite::getInstance()->test);
}
@ -101,19 +100,7 @@ function afterEach(Closure $closure = null): AfterEachCall
/**
* Runs the given closure after all tests in the current file.
*/
function afterAll(Closure $closure = null): void
function afterAll(Closure $closure): void
{
TestSuite::getInstance()->afterAll->set($closure);
}
/**
* Creates a new expectation.
*
* @param mixed $value the Value
*
* @return Expectation
*/
function expect($value)
{
return test()->expect($value);
}

View File

@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace Pest\Laravel\Commands;
use Laravel\Dusk\Console\DuskCommand;
/**
* @internal
*/
final class PestDuskCommand extends DuskCommand
{
/**
* The console command name.
*
* @var string
*/
protected $signature = 'pest:dusk {--without-tty : Disable output to TTY}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Run the Dusk tests for the application with Pest';
/**
* Get the PHP binary to execute.
*
* @return array<string>
*/
protected function binary()
{
if ('phpdbg' === PHP_SAPI) {
return [PHP_BINARY, '-qrr', 'vendor/pestphp/pest/bin/pest'];
}
return [PHP_BINARY, 'vendor/pestphp/pest/bin/pest'];
}
}

View File

@ -5,7 +5,9 @@ declare(strict_types=1);
namespace Pest\Laravel;
use Illuminate\Support\ServiceProvider;
use Laravel\Dusk\Console\DuskCommand;
use Pest\Laravel\Commands\PestDatasetCommand;
use Pest\Laravel\Commands\PestDuskCommand;
use Pest\Laravel\Commands\PestInstallCommand;
use Pest\Laravel\Commands\PestTestCommand;
@ -22,6 +24,12 @@ final class PestServiceProvider extends ServiceProvider
PestTestCommand::class,
PestDatasetCommand::class,
]);
if (class_exists(DuskCommand::class)) {
$this->commands([
PestDuskCommand::class,
]);
}
}
}
}

View File

@ -1,80 +0,0 @@
<?php
declare(strict_types=1);
namespace Pest;
use PHPUnit\Framework\ExpectationFailedException;
use SebastianBergmann\Exporter\Exporter;
/**
* @internal
*
* @mixin Expectation
*/
final class OppositeExpectation
{
/**
* @var Expectation
*/
private $original;
/**
* Creates a new opposite expectation.
*/
public function __construct(Expectation $original)
{
$this->original = $original;
}
/**
* Handle dynamic method calls into the original expectation.
*
* @param array<int, mixed> $arguments
*/
public function __call(string $name, array $arguments): Expectation
{
try {
/* @phpstan-ignore-next-line */
$this->original->{$name}(...$arguments);
} catch (ExpectationFailedException $e) {
return $this->original;
}
// @phpstan-ignore-next-line
$this->throwExpectationFailedExpection($name, $arguments);
}
/**
* Handle dynamic properties gets into the original expectation.
*/
public function __get(string $name): Expectation
{
try {
/* @phpstan-ignore-next-line */
$this->original->{$name};
} catch (ExpectationFailedException $e) {
return $this->original;
}
// @phpstan-ignore-next-line
$this->throwExpectationFailedExpection($name);
}
/**
* Creates a new expectation failed exception
* with a nice readable message.
*
* @param array<int, mixed> $arguments
*/
private function throwExpectationFailedExpection(string $name, array $arguments = []): void
{
$exporter = new Exporter();
$toString = function ($argument) use ($exporter): string {
return $exporter->shortenedExport($argument);
};
throw new ExpectationFailedException(sprintf('Expecting %s not %s %s.', $toString($this->original->value), strtolower((string) preg_replace('/(?<!\ )[A-Z]/', ' $0', $name)), implode(' ', array_map(function ($argument) use ($toString): string { return $toString($argument); }, $arguments))));
}
}

View File

@ -9,7 +9,6 @@ use Pest\Factories\TestCaseFactory;
use Pest\Support\Backtrace;
use Pest\Support\NullClosure;
use Pest\TestSuite;
use PHPUnit\Framework\ExecutionOrderDependency;
use SebastianBergmann\Exporter\Exporter;
/**
@ -78,7 +77,7 @@ final class TestCall
* Runs the current test multiple times with
* each item of the given `iterable`.
*
* @param \Closure|iterable<int, mixed>|string $data
* @param \Closure|iterable<int|string, mixed>|string $data
*/
public function with($data): TestCall
{
@ -92,15 +91,9 @@ final class TestCall
*/
public function depends(string ...$tests): TestCall
{
$className = $this->testCaseFactory->getClassName();
$tests = array_map(function (string $test) use ($className): ExecutionOrderDependency {
return ExecutionOrderDependency::createFromDependsAnnotation($className, $test);
}, $tests);
$this->testCaseFactory
->factoryProxies
->add(Backtrace::file(), Backtrace::line(), 'setDependencies', [$tests]);
->add(Backtrace::file(), Backtrace::line(), 'addDependencies', [$tests]);
return $this;
}

View File

@ -6,5 +6,5 @@ namespace Pest;
function version(): string
{
return '0.3.1';
return '0.3.19';
}

View File

@ -30,7 +30,7 @@ final class HigherOrderMessageCollection
public function chain(object $target): void
{
foreach ($this->messages as $message) {
$target = $message->call($target);
$target = $message->call($target) ?? $target;
}
}

View File

@ -24,7 +24,6 @@ final class TeamCity extends DefaultResultPrinter
private const DURATION = 'duration';
private const TEST_SUITE_STARTED = 'testSuiteStarted';
private const TEST_SUITE_FINISHED = 'testSuiteFinished';
private const TEST_FAILED = 'testFailed';
/** @var int */
private $flowId;
@ -57,7 +56,7 @@ final class TeamCity extends DefaultResultPrinter
/** @phpstan-ignore-next-line */
public function startTestSuite(TestSuite $suite): void
{
$this->flowId = getmypid();
$this->flowId = (int) getmypid();
if (!$this->isSummaryTestCountPrinted) {
$this->printEvent(
@ -149,19 +148,7 @@ final class TeamCity extends DefaultResultPrinter
*/
public function addError(Test $test, Throwable $t, float $time): void
{
if (!TeamCity::isPestTest($test)) {
$this->phpunitTeamCity->addError($test, $t, $time);
return;
}
$this->printEvent(
self::TEST_FAILED, [
self::NAME => $test->getName(),
'message' => $t->getMessage(),
'details' => $t->getTraceAsString(),
self::DURATION => self::toMilliseconds($time),
]);
$this->phpunitTeamCity->addError($test, $t, $time);
}
/**
@ -171,19 +158,7 @@ final class TeamCity extends DefaultResultPrinter
*/
public function addWarning(Test $test, Warning $e, float $time): void
{
if (!TeamCity::isPestTest($test)) {
$this->phpunitTeamCity->addWarning($test, $e, $time);
return;
}
$this->printEvent(
self::TEST_FAILED, [
self::NAME => $test->getName(),
'message' => $e->getMessage(),
'details' => $e->getTraceAsString(),
self::DURATION => self::toMilliseconds($time),
]);
$this->phpunitTeamCity->addWarning($test, $e, $time);
}
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
@ -230,6 +205,9 @@ final class TeamCity extends DefaultResultPrinter
private static function isPestTest(Test $test): bool
{
return in_array(TestCase::class, class_uses($test), true);
/** @var array<string, string> $uses */
$uses = class_uses($test);
return in_array(TestCase::class, $uses, true);
}
}

View File

@ -12,10 +12,10 @@
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</include>
</coverage>
</phpunit>

View File

@ -9,9 +9,9 @@
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
</include>
</coverage>
</phpunit>

View File

@ -0,0 +1,5 @@
Pest Options:
--init Initialise a standard Pest configuration
--coverage Enable coverage and output to standard output
--min=<N> Set the minimum required coverage percentage (<N>), and fail if not met
--group=<name> Only runs tests from the specified group(s)

View File

@ -2,191 +2,6 @@
PASS Tests\CustomTestCase\ExecutedTest
✓ that gets executed
PASS Tests\Expect\not
✓ not property calls
PASS Tests\Expect\toBe
✓ expect true → toBeTrue → and false → toBeFalse
✓ strict comparisons
✓ failures
✓ not failures
PASS Tests\Expect\toBeArray
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeBool
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeCallable
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeDirectory
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeEmpty
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeFalse
✓ strict comparisons
✓ failures
✓ not failures
PASS Tests\Expect\toBeFile
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeFloat
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeGreatherThan
✓ passes
✓ failures
✓ not failures
PASS Tests\Expect\toBeGreatherThanOrEqual
✓ passes
✓ failures
✓ not failures
PASS Tests\Expect\toBeInfinite
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeInstanceOf
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeInt
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeIterable
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeLessThan
✓ passes
✓ failures
✓ not failures
PASS Tests\Expect\toBeLessThanOrEqual
✓ passes
✓ failures
✓ not failures
PASS Tests\Expect\toBeNAN
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeNull
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeNumeric
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeObject
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeReadableDirectory
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeReadableFile
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeResource
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeScalar
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeString
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeTrue
✓ strict comparisons
✓ failures
✓ not failures
PASS Tests\Expect\toBeWritableDirectory
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toBeWritableFile
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toContain
✓ passes strings
✓ passes arrays
✓ failures
✓ not failures
PASS Tests\Expect\toEqual
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toEqualCanonicalizing
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toEqualWithDelta
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toHaveCount
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toHaveKey
✓ pass
✓ failures
✓ not failures
PASS Tests\Expect\toHaveProperty
✓ pass
✓ failures
✓ not failures
PASS Tests\Features\AfterAll
✓ deletes file after all
@ -225,6 +40,9 @@
✓ eager wrapped registered datasets with (1)
✓ eager wrapped registered datasets with (2)
✓ eager registered wrapped datasets did the job right
✓ named datasets with data set "one" (1)
✓ named datasets with data set "two" (2)
✓ named datasets did the job right
✓ lazy named datasets with (Bar Object (...))
✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #1
✓ it creates unique test case names with ('Name 1', Pest\Plugin Object (), true) #2
@ -248,6 +66,7 @@
PASS Tests\Features\HigherOrderTests
✓ it proxies calls to object
✓ it is capable doing multiple assertions
PASS Tests\Features\It
✓ it is a test
@ -272,6 +91,7 @@
- it skips with truthy closure condition
✓ it do not skips with falsy closure condition
- it skips with condition and message → skipped because foo
- it skips when skip after assertion
PASS Tests\Features\Test
✓ a test
@ -313,6 +133,12 @@
✓ it throws exception when `process isolation` is true
✓ it do not throws exception when `process isolation` is false
PASS Tests\Unit\Console\Help
✓ it outputs the help information when --help is used
PASS Tests\Unit\Datasets
✓ it show the names of named datasets in their description
PASS Tests\Unit\Plugins\Version
✓ it outputs the version when --version is used
✓ it do not outputs version when --version is not used
@ -336,6 +162,9 @@
PASS Tests\Unit\TestSuite
✓ it does not allow to add the same test description twice
PASS Tests\Visual\Help
✓ visual snapshot of help command output
PASS Tests\Visual\SingleTestOrDirectory
✓ allows to run a single test
✓ allows to run a directory
@ -348,10 +177,16 @@
PASS Tests\Features\Depends
✓ first
✓ second
✓ it asserts true is true
✓ depends
✓ depends with ...params
✓ depends with defined arguments
✓ depends run test only once
✓ depends works with the correct test name
Tests: 6 skipped, 208 passed
PASS Tests\Features\DependsInheritance
✓ it is a test
✓ it uses correct parent class
Tests: 7 skipped, 108 passed

View File

@ -1,10 +0,0 @@
<?php
test('not property calls', function () {
expect(true)
->toBeTrue()
->not()->toBeFalse()
->not->toBeFalse
->and(false)
->toBeFalse();
});

View File

@ -1,20 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
expect(true)->toBeTrue()->and(false)->toBeFalse();
test('strict comparisons', function () {
$nuno = new stdClass();
$dries = new stdClass();
expect($nuno)->toBe($nuno)->not->toBe($dries);
});
test('failures', function () {
expect(1)->toBe(2);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(1)->not->toBe(1);
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect([1, 2, 3])->toBeArray();
expect('1, 2, 3')->not->toBeArray();
});
test('failures', function () {
expect(null)->toBeArray();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(['a', 'b', 'c'])->not->toBeArray();
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(true)->toBeBool();
expect(0)->not->toBeBool();
});
test('failures', function () {
expect(null)->toBeBool();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(false)->not->toBeBool();
})->throws(ExpectationFailedException::class);

View File

@ -1,18 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(function () {})->toBeCallable();
expect(null)->not->toBeCallable();
});
test('failures', function () {
$hello = 5;
expect($hello)->toBeCallable();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(function () { return 42; })->not->toBeCallable();
})->throws(ExpectationFailedException::class);

View File

@ -1,17 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
$temp = sys_get_temp_dir();
expect($temp)->toBeDirectory();
});
test('failures', function () {
expect('/random/path/whatever')->toBeDirectory();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect('.')->not->toBeDirectory();
})->throws(ExpectationFailedException::class);

View File

@ -1,18 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect([])->toBeEmpty();
expect(null)->toBeEmpty();
});
test('failures', function () {
expect([1, 2])->toBeEmpty();
expect(' ')->toBeEmpty();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect([])->not->toBeEmpty();
expect(null)->not->toBeEmpty();
})->throws(ExpectationFailedException::class);

View File

@ -1,15 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('strict comparisons', function () {
expect(false)->toBeFalse();
});
test('failures', function () {
expect('')->toBeFalse();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(false)->not->toBe(false);
})->throws(ExpectationFailedException::class);

View File

@ -1,23 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
beforeEach(function () {
touch($this->tempFile = sys_get_temp_dir() . '/fake.file');
});
afterEach(function () {
unlink($this->tempFile);
});
test('pass', function () {
expect($this->tempFile)->toBeFile();
});
test('failures', function () {
expect('/random/path/whatever.file')->toBeFile();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect($this->tempFile)->not->toBeFile();
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(1.0)->toBeFloat();
expect(1)->not->toBeFloat();
});
test('failures', function () {
expect(42)->toBeFloat();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(log(3))->not->toBeFloat();
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('passes', function () {
expect(42)->toBeGreaterThan(41);
expect(4)->toBeGreaterThan(3.9);
});
test('failures', function () {
expect(4)->toBeGreaterThan(4);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(5)->not->toBeGreaterThan(4);
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('passes', function () {
expect(42)->toBeGreaterThanOrEqual(41);
expect(4)->toBeGreaterThanOrEqual(4);
});
test('failures', function () {
expect(4)->toBeGreaterThanOrEqual(4.1);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(5)->not->toBeGreaterThanOrEqual(5);
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(log(0))->toBeInfinite();
expect(log(1))->not->toBeInfinite();
});
test('failures', function () {
expect(asin(2))->toBeInfinite();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(INF)->not->toBeInfinite();
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(new Exception())->toBeInstanceOf(Exception::class);
expect(new Exception())->not->toBeInstanceOf(RuntimeException::class);
});
test('failures', function () {
expect(new Exception())->toBeInstanceOf(RuntimeException::class);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(new Exception())->not->toBeInstanceOf(Exception::class);
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(42)->toBeInt();
expect(42.0)->not->toBeInt();
});
test('failures', function () {
expect(42.0)->toBeInt();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(6 * 7)->not->toBeInt();
})->throws(ExpectationFailedException::class);

View File

@ -1,23 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect([])->toBeIterable();
expect(null)->not->toBeIterable();
});
test('failures', function () {
expect(42)->toBeIterable();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
function gen(): iterable
{
yield 1;
yield 2;
yield 3;
}
expect(gen())->not->toBeIterable();
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('passes', function () {
expect(41)->toBeLessThan(42);
expect(4)->toBeLessThan(5);
});
test('failures', function () {
expect(4)->toBeLessThan(4);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(5)->not->toBeLessThan(6);
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('passes', function () {
expect(41)->toBeLessThanOrEqual(42);
expect(4)->toBeLessThanOrEqual(4);
});
test('failures', function () {
expect(4)->toBeLessThanOrEqual(3.9);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(5)->not->toBeLessThanOrEqual(5);
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(asin(2))->toBeNan();
expect(log(0))->not->toBeNan();
});
test('failures', function () {
expect(1)->toBeNan();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(acos(1.5))->not->toBeNan();
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(null)->toBeNull();
expect('')->not->toBeNull();
});
test('failures', function () {
expect('hello')->toBeNull();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(null)->not->toBeNull();
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(42)->toBeNumeric();
expect('A')->not->toBeNumeric();
});
test('failures', function () {
expect(null)->toBeNumeric();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(6 * 7)->not->toBeNumeric();
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect((object) ['a' => 1])->toBeObject();
expect(['a' => 1])->not->toBeObject();
});
test('failures', function () {
expect(null)->toBeObject();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect((object) 'ciao')->not->toBeObject();
})->throws(ExpectationFailedException::class);

View File

@ -1,15 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(sys_get_temp_dir())->toBeReadableDirectory();
});
test('failures', function () {
expect('/random/path/whatever')->toBeReadableDirectory();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(sys_get_temp_dir())->not->toBeReadableDirectory();
})->throws(ExpectationFailedException::class);

View File

@ -1,23 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
beforeEach(function () {
touch($this->tempFile = sys_get_temp_dir() . '/fake.file');
});
afterEach(function () {
unlink($this->tempFile);
});
test('pass', function () {
expect($this->tempFile)->toBeReadableFile();
});
test('failures', function () {
expect('/random/path/whatever.file')->toBeReadableFile();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect($this->tempFile)->not->toBeReadableFile();
})->throws(ExpectationFailedException::class);

View File

@ -1,22 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
$resource = tmpfile();
afterAll(function () use ($resource) {
fclose($resource);
});
test('pass', function () use ($resource) {
expect($resource)->toBeResource();
expect(null)->not->toBeResource();
});
test('failures', function () {
expect(null)->toBeResource();
})->throws(ExpectationFailedException::class);
test('not failures', function () use ($resource) {
expect($resource)->not->toBeResource();
})->throws(ExpectationFailedException::class);

View File

@ -1,15 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(1.1)->toBeScalar();
});
test('failures', function () {
expect(null)->toBeScalar();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(42)->not->toBeScalar();
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect('1.1')->toBeString();
expect(1.1)->not->toBeString();
});
test('failures', function () {
expect(null)->toBeString();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect('42')->not->toBeString();
})->throws(ExpectationFailedException::class);

View File

@ -1,15 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('strict comparisons', function () {
expect(true)->toBeTrue();
});
test('failures', function () {
expect('')->toBeTrue();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(false)->not->toBe(false);
})->throws(ExpectationFailedException::class);

View File

@ -1,15 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(sys_get_temp_dir())->toBeWritableDirectory();
});
test('failures', function () {
expect('/random/path/whatever')->toBeWritableDirectory();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(sys_get_temp_dir())->not->toBeWritableDirectory();
})->throws(ExpectationFailedException::class);

View File

@ -1,23 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
beforeEach(function () {
touch($this->tempFile = sys_get_temp_dir() . '/fake.file');
});
afterEach(function () {
unlink($this->tempFile);
});
test('pass', function () {
expect($this->tempFile)->toBeWritableFile();
});
test('failures', function () {
expect('/random/path/whatever.file')->toBeWritableFile();
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect($this->tempFile)->not->toBeWritableFile();
})->throws(ExpectationFailedException::class);

View File

@ -1,19 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('passes strings', function () {
expect([1, 2, 42])->toContain(42);
});
test('passes arrays', function () {
expect('Nuno')->toContain('Nu');
});
test('failures', function () {
expect([1, 2, 42])->toContain(3);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect([1, 2, 42])->not->toContain(42);
})->throws(ExpectationFailedException::class);

View File

@ -1,15 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect('00123')->toEqual(123);
});
test('failures', function () {
expect(['a', 'b', 'c'])->toEqual(['a', 'b']);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect('042')->not->toEqual(42);
})->throws(ExpectationFailedException::class);

View File

@ -1,16 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect([1, 2, 3])->toEqualCanonicalizing([3, 1, 2]);
expect(['g', 'a', 'z'])->not->toEqualCanonicalizing(['a', 'z']);
});
test('failures', function () {
expect([3, 2, 1])->toEqualCanonicalizing([1, 2]);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(['a', 'b', 'c'])->not->toEqualCanonicalizing(['b', 'a', 'c']);
})->throws(ExpectationFailedException::class);

View File

@ -1,15 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(1.0)->toEqualWithDelta(1.3, .4);
});
test('failures', function () {
expect(1.0)->toEqualWithDelta(1.5, .1);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(1.0)->not->toEqualWithDelta(1.6, .7);
})->throws(ExpectationFailedException::class);

View File

@ -1,15 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect([1, 2, 3])->toHaveCount(3);
});
test('failures', function () {
expect([1, 2, 3])->toHaveCount(4);
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect([1, 2, 3])->not->toHaveCount(3);
})->throws(ExpectationFailedException::class);

View File

@ -1,15 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
test('pass', function () {
expect(['a' => 1, 'b', 'c' => 'world'])->toHaveKey('c');
});
test('failures', function () {
expect(['a' => 1, 'b', 'c' => 'world'])->toHaveKey('hello');
})->throws(ExpectationFailedException::class);
test('not failures', function () {
expect(['a' => 1, 'hello' => 'world', 'c'])->not->toHaveKey('hello');
})->throws(ExpectationFailedException::class);

View File

@ -1,18 +0,0 @@
<?php
use PHPUnit\Framework\ExpectationFailedException;
$obj = new stdClass();
$obj->foo = 'bar';
test('pass', function () use ($obj) {
expect($obj)->toHaveProperty('foo');
});
test('failures', function () use ($obj) {
expect($obj)->toHaveProperty('bar');
})->throws(ExpectationFailedException::class);
test('not failures', function () use ($obj) {
expect($obj)->not->toHaveProperty('foo');
})->throws(ExpectationFailedException::class);

View File

@ -6,7 +6,7 @@ beforeEach(function () use ($state) {
$this->state = $state;
});
afterEach(function () use ($state) {
afterEach(function () {
$this->state->bar = 2;
});

View File

@ -95,6 +95,18 @@ test('eager registered wrapped datasets did the job right', function () use ($st
expect($state->text)->toBe('1212121212');
});
test('named datasets', function ($text) use ($state, $datasets) {
$state->text .= $text;
expect($datasets)->toContain([$text]);
})->with([
'one' => [1],
'two' => [2],
]);
test('named datasets did the job right', function () use ($state) {
expect($state->text)->toBe('121212121212');
});
class Bar
{
public $name = 1;
@ -104,7 +116,7 @@ $namedDatasets = [
new Bar(),
];
test('lazy named datasets', function ($text) use ($state, $datasets) {
test('lazy named datasets', function ($text) {
expect(true)->toBeTrue();
})->with($namedDatasets);

View File

@ -32,3 +32,7 @@ test('depends with defined arguments', function (string $first, string $second)
test('depends run test only once', function () use (&$runCounter) {
expect($runCounter)->toBe(2);
})->depends('first', 'second');
// Regression tests. See https://github.com/pestphp/pest/pull/216
it('asserts true is true')->assertTrue(true);
test('depends works with the correct test name')->assertTrue(true)->depends('it asserts true is true');

View File

@ -0,0 +1,22 @@
<?php
use PHPUnit\Framework\TestCase;
class InheritanceTest extends TestCase
{
public function foo()
{
return 'bar';
}
}
uses(InheritanceTest::class);
it('is a test', function () {
expect(true)->toBeTrue();
});
it('uses correct parent class', function () {
expect(get_parent_class($this))->toEqual(InheritanceTest::class);
expect($this->foo())->toEqual('bar');
})->depends('it is a test');

View File

@ -4,4 +4,8 @@ beforeEach()->assertTrue(true);
it('proxies calls to object')->assertTrue(true);
it('is capable doing multiple assertions')
->assertTrue(true)
->assertFalse(false);
afterEach()->assertTrue(true);

View File

@ -27,3 +27,7 @@ it('do not skips with falsy closure condition')
it('skips with condition and message')
->skip(true, 'skipped because foo')
->assertTrue(false);
it('skips when skip after assertion')
->assertTrue(true)
->skip();

View File

@ -22,7 +22,7 @@ test('default php unit tests', function () {
expect($testSuite->tests())->toHaveCount(1);
});
it('removes warnings', function () use ($pestTestCase) {
it('removes warnings', function () {
$testSuite = new TestSuite();
$warningTestCase = new WarningTestCase('No tests found in class "Pest\TestCase".');
$testSuite->addTest($warningTestCase);

View File

@ -0,0 +1,12 @@
<?php
use Pest\Console\Help;
use Symfony\Component\Console\Output\BufferedOutput;
it('outputs the help information when --help is used', function () {
$output = new BufferedOutput();
$plugin = new Help($output);
$plugin();
expect($output->fetch())->toContain('Pest Options:');
});

13
tests/Unit/Datasets.php Normal file
View File

@ -0,0 +1,13 @@
<?php
use Pest\Datasets;
it('show the names of named datasets in their description', function () {
$descriptions = array_keys(Datasets::resolve('test description', [
'one' => [1],
'two' => [[2]],
]));
expect($descriptions[0])->toBe('test description with data set "one" (1)');
expect($descriptions[1])->toBe('test description with data set "two" (array(2))');
});

27
tests/Visual/Help.php Normal file
View File

@ -0,0 +1,27 @@
<?php
use Pest\Console\Help;
use Symfony\Component\Console\Output\BufferedOutput;
test('visual snapshot of help command output', function () {
$snapshot = __DIR__ . '/../.snapshots/help-command.txt';
if (getenv('REBUILD_SNAPSHOTS')) {
$outputBuffer = new BufferedOutput();
$plugin = new Help($outputBuffer);
$plugin();
file_put_contents($snapshot, $outputBuffer->fetch());
}
$output = function () {
$process = (new Symfony\Component\Process\Process(['php', 'bin/pest', '--help']));
$process->run();
return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput());
};
expect($output())->toContain(file_get_contents($snapshot));
})->skip(PHP_OS_FAMILY === 'Windows');