updated packages
This commit is contained in:
1
vendor/phpunit/phpunit/.gitattributes
vendored
1
vendor/phpunit/phpunit/.gitattributes
vendored
@@ -1,4 +1,5 @@
|
||||
/build export-ignore
|
||||
/tools export-ignore
|
||||
|
||||
*.php diff=php
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ Please note that this project is released with a [Contributor Code of Conduct](C
|
||||
|
||||
Please make sure that you have [set up your user name and email address](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup) for use with Git. Strings such as `silly nick name <root@localhost>` look really stupid in the commit history of a project.
|
||||
|
||||
Pull requests for bug fixes must be based on the current stable branch whereas pull requests for new features must be based on the `master` branch.
|
||||
Pull requests for bug fixes must be made for the oldest branch that is [supported](https://phpunit.de/supported-versions.html). Pull requests for new features must be based on the `master` branch.
|
||||
|
||||
We are trying to keep backwards compatibility breaks in PHPUnit to an absolute minimum. Please take this into account when proposing changes.
|
||||
|
||||
@@ -24,7 +24,7 @@ Due to time constraints, we are not always able to respond as quickly as we woul
|
||||
This project comes with a configuration file and an executable for [php-cs-fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) (`.php_cs`) that you can use to (re)format your source code for compliance with this project's coding guidelines:
|
||||
|
||||
```bash
|
||||
$ ./build/tools/php-cs-fixer fix
|
||||
$ ./tools/php-cs-fixer fix
|
||||
```
|
||||
|
||||
## Using PHPUnit from a Git checkout
|
||||
@@ -40,7 +40,7 @@ $ cd phpunit
|
||||
Retrieve PHPUnit's dependencies using [Composer](https://getcomposer.org/):
|
||||
|
||||
```bash
|
||||
$ composer install
|
||||
$ ./tools/composer install
|
||||
```
|
||||
|
||||
The `phpunit` script can be used to invoke the PHPUnit test runner:
|
||||
|
||||
2
vendor/phpunit/phpunit/.gitignore
vendored
2
vendor/phpunit/phpunit/.gitignore
vendored
@@ -2,7 +2,6 @@
|
||||
/.idea
|
||||
/.php_cs
|
||||
/.php_cs.cache
|
||||
/.phpunit.result.cache
|
||||
/build/documentation
|
||||
/build/logfiles
|
||||
/build/phar
|
||||
@@ -18,3 +17,4 @@
|
||||
/tests/end-to-end/*.out
|
||||
/tests/end-to-end/*.php
|
||||
/vendor
|
||||
.phpunit.result.cache
|
||||
|
||||
7
vendor/phpunit/phpunit/.phan/config.php
vendored
7
vendor/phpunit/phpunit/.phan/config.php
vendored
@@ -1,7 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
return [
|
||||
'directory_list' => [ 'src/', 'vendor/' ],
|
||||
'exclude_analysis_directory_list' => [ 'vendor/', 'src/Framework/Assert/' ],
|
||||
|
||||
'target_php_version' => '7.1',
|
||||
];
|
||||
4
vendor/phpunit/phpunit/.php_cs.dist
vendored
4
vendor/phpunit/phpunit/.php_cs.dist
vendored
@@ -141,6 +141,10 @@ return PhpCsFixer\Config::create()
|
||||
],
|
||||
],
|
||||
'ordered_imports' => true,
|
||||
'ordered_interfaces' => [
|
||||
'direction' => 'ascend',
|
||||
'order' => 'alpha',
|
||||
],
|
||||
'phpdoc_add_missing_param_annotation' => true,
|
||||
'phpdoc_align' => true,
|
||||
'phpdoc_annotation_without_dot' => true,
|
||||
|
||||
15
vendor/phpunit/phpunit/.travis.yml
vendored
15
vendor/phpunit/phpunit/.travis.yml
vendored
@@ -1,7 +1,5 @@
|
||||
language: php
|
||||
|
||||
sudo: false
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
@@ -11,11 +9,8 @@ php:
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
- master
|
||||
|
||||
matrix:
|
||||
allow_failures:
|
||||
- php: master
|
||||
fast_finish: true
|
||||
|
||||
env:
|
||||
@@ -26,11 +21,11 @@ env:
|
||||
- DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest"
|
||||
|
||||
before_install:
|
||||
- ./build/tools/composer clear-cache
|
||||
- ./tools/composer clear-cache
|
||||
|
||||
install:
|
||||
- if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry ./build/tools/composer update $DEFAULT_COMPOSER_FLAGS; fi
|
||||
- if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry ./build/tools/composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi
|
||||
- if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry ./tools/composer update $DEFAULT_COMPOSER_FLAGS; fi
|
||||
- if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry ./tools/composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi
|
||||
|
||||
before_script:
|
||||
- echo 'zend.assertions=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
|
||||
@@ -53,9 +48,9 @@ notifications:
|
||||
jobs:
|
||||
include:
|
||||
- stage: Static Code Analysis
|
||||
php: 7.2
|
||||
php: 7.3
|
||||
env: php-cs-fixer
|
||||
install:
|
||||
- phpenv config-rm xdebug.ini
|
||||
script:
|
||||
- ./build/tools/php-cs-fixer fix --dry-run -v --show-progress=dots --diff-format=udiff
|
||||
- ./tools/php-cs-fixer fix --dry-run -v --show-progress=dots --diff-format=udiff
|
||||
|
||||
108
vendor/phpunit/phpunit/ChangeLog-6.5.md
vendored
108
vendor/phpunit/phpunit/ChangeLog-6.5.md
vendored
@@ -1,108 +0,0 @@
|
||||
# Changes in PHPUnit 6.5
|
||||
|
||||
All notable changes of the PHPUnit 6.5 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [6.5.13] - 2018-09-08
|
||||
|
||||
* Fixed [#3181](https://github.com/sebastianbergmann/phpunit/issues/3181): `--filter` should be case-insensitive
|
||||
* Fixed [#3234](https://github.com/sebastianbergmann/phpunit/issues/3234): `assertArraySubset()` with `$strict=true` does not display differences properly
|
||||
* Fixed [#3254](https://github.com/sebastianbergmann/phpunit/issues/3254): TextUI test runner cannot run a `Test` instance that is not a `TestSuite`
|
||||
|
||||
## [6.5.12] - 2018-08-22
|
||||
|
||||
* Fixed [#3248](https://github.com/sebastianbergmann/phpunit/issues/3248) and [#3233](https://github.com/sebastianbergmann/phpunit/issues/3233): `phpunit.xsd` dictates element order where it should not
|
||||
* Fixed [#3251](https://github.com/sebastianbergmann/phpunit/issues/3251): TeamCity result logger is missing test duration information
|
||||
|
||||
## [6.5.11] - 2018-08-07
|
||||
|
||||
* Fixed [#3219](https://github.com/sebastianbergmann/phpunit/issues/3219): `getMockFromWsdl()` generates invalid PHP code when WSDL filename contains special characters
|
||||
|
||||
## [6.5.10] - 2018-08-03
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3209](https://github.com/sebastianbergmann/phpunit/issues/3209): `Test::run()` and `TestCase::run()` interface contradiction
|
||||
* Fixed [#3218](https://github.com/sebastianbergmann/phpunit/issues/3218): `prefix` attribute for `directory` node missing from `phpunit.xml` XSD
|
||||
* Fixed [#3225](https://github.com/sebastianbergmann/phpunit/issues/3225): `coverage-php` missing from `phpunit.xsd`
|
||||
|
||||
## [6.5.9] - 2018-07-03
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3142](https://github.com/sebastianbergmann/phpunit/issues/3142): Method-level annotations (`@backupGlobals`, `@backupStaticAttributes`, `@errorHandler`, `@preserveGlobalState`) do not override class-level annotations
|
||||
|
||||
## [6.5.8] - 2018-04-10
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#2830](https://github.com/sebastianbergmann/phpunit/issues/2830): `@runClassInSeparateProcess` does not work for tests that use `@dataProvider`
|
||||
|
||||
## [6.5.7] - 2018-02-26
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#2974](https://github.com/sebastianbergmann/phpunit/issues/2974): JUnit XML logfile contains invalid characters when test output contains binary data
|
||||
|
||||
## [6.5.6] - 2018-02-01
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#2236](https://github.com/sebastianbergmann/phpunit/issues/2236): Exceptions in `tearDown()` do not affect `getStatus()`
|
||||
* Fixed [#2950](https://github.com/sebastianbergmann/phpunit/issues/2950): Class extending `PHPUnit\Framework\TestSuite` does not extend `PHPUnit\FrameworkTestCase`
|
||||
* Fixed [#2972](https://github.com/sebastianbergmann/phpunit/issues/2972): PHPUnit crashes when test suite contains both `.phpt` files and unconventionally named tests
|
||||
|
||||
## [6.5.5] - 2017-12-17
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#2922](https://github.com/sebastianbergmann/phpunit/issues/2922): Test class is not discovered when there is a test class with `@group` and provider throwing exception in it, tests are run with `--exclude-group` for that group, there is another class called later (after the class from above), and the name of that another class does not match its filename
|
||||
|
||||
## [6.5.4] - 2017-12-10
|
||||
|
||||
### Changed
|
||||
|
||||
* Require version 5.0.5 of `phpunit/phpunit-mock-objects` for [phpunit-mock-objects#394](https://github.com/sebastianbergmann/phpunit-mock-objects/issues/394)
|
||||
|
||||
## [6.5.3] - 2017-12-06
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed an issue with PHPT tests when `forceCoversAnnotation="true"` is configured
|
||||
|
||||
## [6.5.2] - 2017-12-02
|
||||
|
||||
### Changed
|
||||
|
||||
* Require version 5.0.4 of `phpunit/phpunit-mock-objects` for [phpunit-mock-objects#388](https://github.com/sebastianbergmann/phpunit-mock-objects/issues/388)
|
||||
|
||||
## [6.5.1] - 2017-12-01
|
||||
|
||||
* Fixed [#2886](https://github.com/sebastianbergmann/phpunit/pull/2886): Forced environment variables do not affect `getenv()`
|
||||
|
||||
## [6.5.0] - 2017-12-01
|
||||
|
||||
### Added
|
||||
|
||||
* Implemented [#2286](https://github.com/sebastianbergmann/phpunit/issues/2286): Optional `$exit` parameter for `PHPUnit\TextUI\TestRunner::run()`
|
||||
* Implemented [#2496](https://github.com/sebastianbergmann/phpunit/issues/2496): Allow shallow copy of dependencies
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#2654](https://github.com/sebastianbergmann/phpunit/issues/2654): Problems with `assertJsonStringEqualsJsonString()`
|
||||
* Fixed [#2810](https://github.com/sebastianbergmann/phpunit/pull/2810): Code Coverage for PHPT tests does not work
|
||||
|
||||
[6.5.13]: https://github.com/sebastianbergmann/phpunit/compare/6.5.12...6.5.13
|
||||
[6.5.12]: https://github.com/sebastianbergmann/phpunit/compare/6.5.11...6.5.12
|
||||
[6.5.11]: https://github.com/sebastianbergmann/phpunit/compare/6.5.10...6.5.11
|
||||
[6.5.10]: https://github.com/sebastianbergmann/phpunit/compare/6.5.9...6.5.10
|
||||
[6.5.9]: https://github.com/sebastianbergmann/phpunit/compare/6.5.8...6.5.9
|
||||
[6.5.8]: https://github.com/sebastianbergmann/phpunit/compare/6.5.7...6.5.8
|
||||
[6.5.7]: https://github.com/sebastianbergmann/phpunit/compare/6.5.6...6.5.7
|
||||
[6.5.6]: https://github.com/sebastianbergmann/phpunit/compare/6.5.5...6.5.6
|
||||
[6.5.5]: https://github.com/sebastianbergmann/phpunit/compare/6.5.4...6.5.5
|
||||
[6.5.4]: https://github.com/sebastianbergmann/phpunit/compare/6.5.3...6.5.4
|
||||
[6.5.3]: https://github.com/sebastianbergmann/phpunit/compare/6.5.2...6.5.3
|
||||
[6.5.2]: https://github.com/sebastianbergmann/phpunit/compare/6.5.1...6.5.2
|
||||
[6.5.1]: https://github.com/sebastianbergmann/phpunit/compare/6.5.0...6.5.1
|
||||
[6.5.0]: https://github.com/sebastianbergmann/phpunit/compare/6.4...6.5.0
|
||||
|
||||
85
vendor/phpunit/phpunit/ChangeLog-7.5.md
vendored
85
vendor/phpunit/phpunit/ChangeLog-7.5.md
vendored
@@ -2,6 +2,81 @@
|
||||
|
||||
All notable changes of the PHPUnit 7.5 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [7.5.11] - 2019-05-14
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3683](https://github.com/sebastianbergmann/phpunit/issues/3683): Regression in PHPUnit 7.5.10 with regard to Exception stubbing/mocking
|
||||
|
||||
## [7.5.10] - 2019-05-09
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3414](https://github.com/sebastianbergmann/phpunit/pull/3414): `willThrowException()` only accepts `Exception`, not `Throwable`
|
||||
* Fixed [#3587](https://github.com/sebastianbergmann/phpunit/issues/3587): `.phpunit.result.cache` file is all over the place
|
||||
* Fixed [#3596](https://github.com/sebastianbergmann/phpunit/issues/3596): Mocking an interface that extends another interface forgets to mock its own methods
|
||||
* Fixed [#3674](https://github.com/sebastianbergmann/phpunit/issues/3674): `TypeError` when an incorrect file path is given
|
||||
|
||||
## [7.5.9] - 2019-04-19
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3607](https://github.com/sebastianbergmann/phpunit/issues/3607): Return value generation interferes with proxying to original method
|
||||
|
||||
## [7.5.8] - 2019-03-26
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3564](https://github.com/sebastianbergmann/phpunit/issues/3564): Production code uses class from test suite's fixture
|
||||
|
||||
## [7.5.7] - 2019-03-16
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3480](https://github.com/sebastianbergmann/phpunit/issues/3480): Wrong return type declaration for `TestCase::getExpectedExceptionMessage()` and `TestCase::getExpectedExceptionMessageRegExp()`
|
||||
* Fixed [#3550](https://github.com/sebastianbergmann/phpunit/issues/3550): Check for valid attribute names in `assertObjectHasAttribute()` is too strict
|
||||
|
||||
## [7.5.6] - 2019-02-18
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3530](https://github.com/sebastianbergmann/phpunit/issues/3530): `generateClassFromWsdl()` does not handle methods with multiple output values
|
||||
* Fixed [#3531](https://github.com/sebastianbergmann/phpunit/issues/3531): Test suite fails on warning
|
||||
* Fixed [#3534](https://github.com/sebastianbergmann/phpunit/pull/3534): Wrong message in `ConstraintTestCase`
|
||||
|
||||
## [7.5.5] - 2019-02-15
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3011](https://github.com/sebastianbergmann/phpunit/issues/3011): Unsupported PHPT `--SECTION--` throws unhandled exception
|
||||
* Fixed [#3461](https://github.com/sebastianbergmann/phpunit/issues/3461): `StringEndsWith` matches too loosely
|
||||
* Fixed [#3515](https://github.com/sebastianbergmann/phpunit/issues/3515): Random order seed is only printed in verbose mode
|
||||
* Fixed [#3517](https://github.com/sebastianbergmann/phpunit/issues/3517): Useless error message when depending on test that does not exist
|
||||
|
||||
## [7.5.4] - 2019-02-07
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3352](https://github.com/sebastianbergmann/phpunit/issues/3352): Using `phpunit.phar` with PHPDBG does not work with `auto_globals_jit=On`
|
||||
* Fixed [#3502](https://github.com/sebastianbergmann/phpunit/issues/3502): Numeric `@ticket` or `@group` annotations no longer work
|
||||
|
||||
## [7.5.3] - 2019-02-01
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3490](https://github.com/sebastianbergmann/phpunit/pull/3490): Exceptions in `tearDownAfterClass()` kill PHPUnit
|
||||
|
||||
### Deprecated
|
||||
|
||||
* The method `assertArraySubset()` is now deprecated. There is no behavioral change in this version of PHPUnit. Using this method will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 this method will be removed.
|
||||
|
||||
## [7.5.2] - 2019-01-15
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3456](https://github.com/sebastianbergmann/phpunit/pull/3456): Generator for Xdebug filter script does not handle directories with leading `.` correctly
|
||||
* Fixed [#3459](https://github.com/sebastianbergmann/phpunit/issues/3459): `@requires` function swallows digits at the end of function name
|
||||
|
||||
## [7.5.1] - 2018-12-12
|
||||
|
||||
### Fixed
|
||||
@@ -33,6 +108,16 @@ All notable changes of the PHPUnit 7.5 release series are documented in this fil
|
||||
* Fixed [#3429](https://github.com/sebastianbergmann/phpunit/pull/3429): Inefficient loop in `getHookMethods()`
|
||||
* Fixed [#3437](https://github.com/sebastianbergmann/phpunit/pull/3437): JUnit logger skips PHPT tests
|
||||
|
||||
[7.5.11]: https://github.com/sebastianbergmann/phpunit/compare/7.5.10...7.5.11
|
||||
[7.5.10]: https://github.com/sebastianbergmann/phpunit/compare/7.5.9...7.5.10
|
||||
[7.5.9]: https://github.com/sebastianbergmann/phpunit/compare/7.5.8...7.5.9
|
||||
[7.5.8]: https://github.com/sebastianbergmann/phpunit/compare/7.5.7...7.5.8
|
||||
[7.5.7]: https://github.com/sebastianbergmann/phpunit/compare/7.5.6...7.5.7
|
||||
[7.5.6]: https://github.com/sebastianbergmann/phpunit/compare/7.5.5...7.5.6
|
||||
[7.5.5]: https://github.com/sebastianbergmann/phpunit/compare/7.5.4...7.5.5
|
||||
[7.5.4]: https://github.com/sebastianbergmann/phpunit/compare/7.5.3...7.5.4
|
||||
[7.5.3]: https://github.com/sebastianbergmann/phpunit/compare/7.5.2...7.5.3
|
||||
[7.5.2]: https://github.com/sebastianbergmann/phpunit/compare/7.5.1...7.5.2
|
||||
[7.5.1]: https://github.com/sebastianbergmann/phpunit/compare/7.5.0...7.5.1
|
||||
[7.5.0]: https://github.com/sebastianbergmann/phpunit/compare/7.4.5...7.5.0
|
||||
|
||||
|
||||
2
vendor/phpunit/phpunit/LICENSE
vendored
2
vendor/phpunit/phpunit/LICENSE
vendored
@@ -1,6 +1,6 @@
|
||||
PHPUnit
|
||||
|
||||
Copyright (c) 2001-2018, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
Copyright (c) 2001-2019, Sebastian Bergmann <sebastian@phpunit.de>.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
6
vendor/phpunit/phpunit/appveyor.yml
vendored
6
vendor/phpunit/phpunit/appveyor.yml
vendored
@@ -10,10 +10,10 @@ environment:
|
||||
COMPOSER_ROOT_VERSION: '7.0-dev'
|
||||
|
||||
matrix:
|
||||
- PHP_VERSION: '7.1.11'
|
||||
- PHP_VERSION: '7.1'
|
||||
XDEBUG_VERSION: '2.5.5-7.1'
|
||||
DEPENDENCIES: '--prefer-lowest'
|
||||
- PHP_VERSION: '7.1.11'
|
||||
- PHP_VERSION: '7.1'
|
||||
XDEBUG_VERSION: '2.5.5-7.1'
|
||||
DEPENDENCIES: ''
|
||||
|
||||
@@ -31,7 +31,7 @@ install:
|
||||
- IF NOT EXIST c:\php mkdir c:\php
|
||||
- IF NOT EXIST c:\php\%PHP_VERSION% mkdir c:\php\%PHP_VERSION%
|
||||
- cd c:\php\%PHP_VERSION%
|
||||
- IF NOT EXIST php-installed.txt curl -fsS -o php-%PHP_VERSION%-Win32-VC14-x86.zip https://windows.php.net/downloads/releases/archives/php-%PHP_VERSION%-Win32-VC14-x86.zip
|
||||
- IF NOT EXIST php-installed.txt curl -fsS -o php-%PHP_VERSION%-Win32-VC14-x86.zip https://windows.php.net/downloads/releases/latest/php-%PHP_VERSION%-Win32-VC14-x86-latest.zip
|
||||
- IF NOT EXIST php-installed.txt 7z x php-%PHP_VERSION%-Win32-VC14-x86.zip -y >nul
|
||||
- IF NOT EXIST php-installed.txt del /Q *.zip
|
||||
- IF NOT EXIST php-installed.txt copy /Y php.ini-development php.ini
|
||||
|
||||
20
vendor/phpunit/phpunit/build.xml
vendored
20
vendor/phpunit/phpunit/build.xml
vendored
@@ -27,7 +27,7 @@
|
||||
</target>
|
||||
|
||||
<target name="validate-composer-json" depends="clean" unless="validate-composer-json.done" description="Validate composer.json">
|
||||
<exec executable="${basedir}/build/tools/composer" failonerror="true" taskname="composer">
|
||||
<exec executable="${basedir}/tools/composer" failonerror="true" taskname="composer">
|
||||
<arg value="validate"/>
|
||||
<arg value="--strict"/>
|
||||
<arg value="${basedir}/composer.json"/>
|
||||
@@ -43,13 +43,13 @@
|
||||
<target name="install-dependencies" unless="dependencies-installed" depends="-dependencies-installed,validate-composer-json" description="Install dependencies with Composer">
|
||||
<copy file="${basedir}/composer.json" tofile="${basedir}/composer.json.bak"/>
|
||||
|
||||
<exec executable="${basedir}/build/tools/composer" taskname="composer">
|
||||
<exec executable="${basedir}/tools/composer" taskname="composer">
|
||||
<arg value="require"/>
|
||||
<arg value="--no-update"/>
|
||||
<arg value="phpunit/php-invoker:^2.0"/>
|
||||
</exec>
|
||||
|
||||
<exec executable="${basedir}/build/tools/composer" taskname="composer">
|
||||
<exec executable="${basedir}/tools/composer" taskname="composer">
|
||||
<arg value="update"/>
|
||||
<arg value="--no-interaction"/>
|
||||
<arg value="--no-progress"/>
|
||||
@@ -61,7 +61,7 @@
|
||||
</target>
|
||||
|
||||
<target name="check-dependencies" description="Performs check for outdated dependencies">
|
||||
<exec executable="${basedir}/build/tools/composer" taskname="composer">
|
||||
<exec executable="${basedir}/tools/composer" taskname="composer">
|
||||
<arg value="show"/>
|
||||
<arg value="--minor-only"/>
|
||||
<arg value="--latest"/>
|
||||
@@ -341,7 +341,7 @@
|
||||
<arg value="${type}"/>
|
||||
</exec>
|
||||
|
||||
<exec executable="${basedir}/build/tools/phpab" taskname="phpab" failonerror="true">
|
||||
<exec executable="${basedir}/tools/phpab" taskname="phpab" failonerror="true">
|
||||
<arg value="--all" />
|
||||
<arg value="--static" />
|
||||
<arg value="--once" />
|
||||
@@ -358,7 +358,7 @@
|
||||
<copy file="${basedir}/build/binary-phar-autoload.php.in" tofile="${basedir}/build/binary-phar-autoload.php"/>
|
||||
<replace file="${basedir}/build/binary-phar-autoload.php" token="X.Y.Z" value="${_version}"/>
|
||||
|
||||
<exec executable="${basedir}/build/tools/phpab" taskname="phpab" failonerror="true">
|
||||
<exec executable="${basedir}/tools/phpab" taskname="phpab" failonerror="true">
|
||||
<arg value="--all" />
|
||||
<arg value="--nolower" />
|
||||
<arg value="--static" />
|
||||
@@ -383,7 +383,7 @@
|
||||
</target>
|
||||
|
||||
<target name="generate-project-documentation" depends="-phploc,-checkstyle,-phpunit">
|
||||
<exec executable="${basedir}/build/tools/phpdox" dir="${basedir}/build" taskname="phpdox"/>
|
||||
<exec executable="${basedir}/tools/phpdox" dir="${basedir}/build" taskname="phpdox"/>
|
||||
</target>
|
||||
|
||||
<target name="update-tools">
|
||||
@@ -392,13 +392,13 @@
|
||||
<arg value="update"/>
|
||||
</exec>
|
||||
|
||||
<exec executable="${basedir}/build/tools/composer">
|
||||
<exec executable="${basedir}/tools/composer">
|
||||
<arg value="self-update"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="-phploc" depends="prepare">
|
||||
<exec executable="${basedir}/build/tools/phploc" output="/dev/null" taskname="phploc">
|
||||
<exec executable="${basedir}/tools/phploc" output="/dev/null" taskname="phploc">
|
||||
<arg value="--count-tests"/>
|
||||
<arg value="--log-xml"/>
|
||||
<arg path="${basedir}/build/logfiles/phploc.xml"/>
|
||||
@@ -408,7 +408,7 @@
|
||||
</target>
|
||||
|
||||
<target name="-checkstyle" depends="prepare">
|
||||
<exec executable="${basedir}/build/tools/php-cs-fixer" output="${basedir}/build/logfiles/checkstyle.xml" error="/dev/null" taskname="php-cs-fixer">
|
||||
<exec executable="${basedir}/tools/php-cs-fixer" output="${basedir}/build/logfiles/checkstyle.xml" error="/dev/null" taskname="php-cs-fixer">
|
||||
<arg value="--diff"/>
|
||||
<arg value="--dry-run"/>
|
||||
<arg value="fix"/>
|
||||
|
||||
2
vendor/phpunit/phpunit/composer.json
vendored
2
vendor/phpunit/phpunit/composer.json
vendored
@@ -35,7 +35,7 @@
|
||||
"phpunit/php-code-coverage": "^6.0.7",
|
||||
"phpunit/php-file-iterator": "^2.0.1",
|
||||
"phpunit/php-text-template": "^1.2.1",
|
||||
"phpunit/php-timer": "^2.0",
|
||||
"phpunit/php-timer": "^2.1",
|
||||
"sebastian/comparator": "^3.0",
|
||||
"sebastian/diff": "^3.0",
|
||||
"sebastian/environment": "^4.0",
|
||||
|
||||
8
vendor/phpunit/phpunit/phive.xml
vendored
8
vendor/phpunit/phpunit/phive.xml
vendored
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phive xmlns="https://phar.io/phive">
|
||||
<phar name="phpab" version="^1.24.1" installed="1.25.1" location="./build/tools/phpab" copy="true"/>
|
||||
<phar name="php-cs-fixer" version="^2.12.0" installed="2.13.1" location="./build/tools/php-cs-fixer" copy="true"/>
|
||||
<phar name="phpdox" version="^0.11.2" installed="0.11.2" location="./build/tools/phpdox" copy="true"/>
|
||||
<phar name="phploc" version="^4.0.1" installed="4.0.1" location="./build/tools/phploc" copy="true"/>
|
||||
<phar name="phpab" version="^1.25" installed="1.25.5" location="./tools/phpab" copy="true"/>
|
||||
<phar name="php-cs-fixer" version="^2.14" installed="2.15.0" location="./tools/php-cs-fixer" copy="true"/>
|
||||
<phar name="phpdox" version="^0.11" installed="0.12.0" location="./tools/phpdox" copy="true"/>
|
||||
<phar name="phploc" version="^4.0" installed="4.0.1" location="./tools/phploc" copy="true"/>
|
||||
</phive>
|
||||
|
||||
0
vendor/phpunit/phpunit/phpunit
vendored
Normal file → Executable file
0
vendor/phpunit/phpunit/phpunit
vendored
Normal file → Executable file
2
vendor/phpunit/phpunit/phpunit.xml
vendored
2
vendor/phpunit/phpunit/phpunit.xml
vendored
@@ -3,6 +3,7 @@
|
||||
xsi:noNamespaceSchemaLocation="phpunit.xsd"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
cacheResult="true"
|
||||
colors="true"
|
||||
verbose="true">
|
||||
<testsuites>
|
||||
<testsuite name="unit">
|
||||
@@ -11,6 +12,7 @@
|
||||
|
||||
<testsuite name="end-to-end">
|
||||
<directory suffix=".phpt">tests/end-to-end</directory>
|
||||
<exclude>tests/end-to-end/_files</exclude>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
|
||||
27
vendor/phpunit/phpunit/src/Framework/Assert.php
vendored
27
vendor/phpunit/phpunit/src/Framework/Assert.php
vendored
@@ -110,6 +110,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3494
|
||||
*/
|
||||
public static function assertArraySubset($subset, $array, bool $checkForObjectIdentity = false, string $message = ''): void
|
||||
{
|
||||
@@ -1250,7 +1252,7 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertClassHasAttribute(string $attributeName, string $className, string $message = ''): void
|
||||
{
|
||||
if (!self::isValidAttributeName($attributeName)) {
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentHelper::factory(1, 'valid attribute name');
|
||||
}
|
||||
|
||||
@@ -1269,7 +1271,7 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertClassNotHasAttribute(string $attributeName, string $className, string $message = ''): void
|
||||
{
|
||||
if (!self::isValidAttributeName($attributeName)) {
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentHelper::factory(1, 'valid attribute name');
|
||||
}
|
||||
|
||||
@@ -1294,7 +1296,7 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertClassHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
|
||||
{
|
||||
if (!self::isValidAttributeName($attributeName)) {
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentHelper::factory(1, 'valid attribute name');
|
||||
}
|
||||
|
||||
@@ -1317,7 +1319,7 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertClassNotHasStaticAttribute(string $attributeName, string $className, string $message = ''): void
|
||||
{
|
||||
if (!self::isValidAttributeName($attributeName)) {
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentHelper::factory(1, 'valid attribute name');
|
||||
}
|
||||
|
||||
@@ -1344,7 +1346,7 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertObjectHasAttribute(string $attributeName, $object, string $message = ''): void
|
||||
{
|
||||
if (!self::isValidAttributeName($attributeName)) {
|
||||
if (!self::isValidObjectAttributeName($attributeName)) {
|
||||
throw InvalidArgumentHelper::factory(1, 'valid attribute name');
|
||||
}
|
||||
|
||||
@@ -1369,7 +1371,7 @@ abstract class Assert
|
||||
*/
|
||||
public static function assertObjectNotHasAttribute(string $attributeName, $object, string $message = ''): void
|
||||
{
|
||||
if (!self::isValidAttributeName($attributeName)) {
|
||||
if (!self::isValidObjectAttributeName($attributeName)) {
|
||||
throw InvalidArgumentHelper::factory(1, 'valid attribute name');
|
||||
}
|
||||
|
||||
@@ -2715,7 +2717,7 @@ abstract class Assert
|
||||
*/
|
||||
public static function readAttribute($classOrObject, string $attributeName)
|
||||
{
|
||||
if (!self::isValidAttributeName($attributeName)) {
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentHelper::factory(2, 'valid attribute name');
|
||||
}
|
||||
|
||||
@@ -2761,7 +2763,7 @@ abstract class Assert
|
||||
throw InvalidArgumentHelper::factory(1, 'class name');
|
||||
}
|
||||
|
||||
if (!self::isValidAttributeName($attributeName)) {
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentHelper::factory(2, 'valid attribute name');
|
||||
}
|
||||
|
||||
@@ -2801,7 +2803,7 @@ abstract class Assert
|
||||
throw InvalidArgumentHelper::factory(1, 'object');
|
||||
}
|
||||
|
||||
if (!self::isValidAttributeName($attributeName)) {
|
||||
if (!self::isValidClassAttributeName($attributeName)) {
|
||||
throw InvalidArgumentHelper::factory(2, 'valid attribute name');
|
||||
}
|
||||
|
||||
@@ -2871,7 +2873,12 @@ abstract class Assert
|
||||
self::$count = 0;
|
||||
}
|
||||
|
||||
private static function isValidAttributeName(string $attributeName): bool
|
||||
private static function isValidObjectAttributeName(string $attributeName): bool
|
||||
{
|
||||
return \preg_match('/[^\x00-\x1f\x7f-\x9f]+/', $attributeName);
|
||||
}
|
||||
|
||||
private static function isValidClassAttributeName(string $attributeName): bool
|
||||
{
|
||||
return \preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/', $attributeName);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,8 @@ function assertArrayHasKey($key, $array, string $message = ''): void
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3494
|
||||
*/
|
||||
function assertArraySubset($subset, $array, bool $checkForObjectIdentity = false, string $message = ''): void
|
||||
{
|
||||
|
||||
@@ -17,6 +17,8 @@ use SebastianBergmann\Comparator\ComparisonFailure;
|
||||
*
|
||||
* Uses array_replace_recursive() to check if a key value subset is part of the
|
||||
* subject array.
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3494
|
||||
*/
|
||||
class ArraySubset extends Constraint
|
||||
{
|
||||
|
||||
@@ -43,6 +43,6 @@ class StringEndsWith extends Constraint
|
||||
*/
|
||||
protected function matches($other): bool
|
||||
{
|
||||
return \substr($other, 0 - \strlen($this->suffix)) == $this->suffix;
|
||||
return \substr($other, 0 - \strlen($this->suffix)) === $this->suffix;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,7 +162,7 @@ class InvocationMocker implements MethodNameMatch
|
||||
/**
|
||||
* @return InvocationMocker
|
||||
*/
|
||||
public function willThrowException(\Exception $exception)
|
||||
public function willThrowException(\Throwable $exception)
|
||||
{
|
||||
$stub = new Stub\Exception($exception);
|
||||
|
||||
|
||||
@@ -458,18 +458,16 @@ class Generator
|
||||
$methodsBuffer = '';
|
||||
|
||||
foreach ($_methods as $method) {
|
||||
$nameStart = \strpos($method, ' ') + 1;
|
||||
$nameEnd = \strpos($method, '(');
|
||||
$name = \substr($method, $nameStart, $nameEnd - $nameStart);
|
||||
\preg_match_all('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\(/', $method, $matches, \PREG_OFFSET_CAPTURE);
|
||||
$lastFunction = \array_pop($matches[0]);
|
||||
$nameStart = $lastFunction[1];
|
||||
$nameEnd = $nameStart + \strlen($lastFunction[0]) - 1;
|
||||
$name = \str_replace('(', '', $lastFunction[0]);
|
||||
|
||||
if (empty($methods) || \in_array($name, $methods, true)) {
|
||||
$args = \explode(
|
||||
$args = \explode(
|
||||
',',
|
||||
\substr(
|
||||
$method,
|
||||
$nameEnd + 1,
|
||||
\strpos($method, ')') - $nameEnd - 1
|
||||
)
|
||||
\str_replace(')', '', \substr($method, $nameEnd + 1))
|
||||
);
|
||||
|
||||
foreach (\range(0, \count($args) - 1) as $i) {
|
||||
@@ -557,6 +555,25 @@ class Generator
|
||||
return $methods;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \ReflectionException
|
||||
*
|
||||
* @return \ReflectionMethod[]
|
||||
*/
|
||||
private function getInterfaceOwnMethods(string $interfaceName): array
|
||||
{
|
||||
$reflect = new ReflectionClass($interfaceName);
|
||||
$methods = [];
|
||||
|
||||
foreach ($reflect->getMethods() as $method) {
|
||||
if ($method->getDeclaringClass()->getName() === $interfaceName) {
|
||||
$methods[] = $method;
|
||||
}
|
||||
}
|
||||
|
||||
return $methods;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $code
|
||||
* @param string $className
|
||||
@@ -730,16 +747,49 @@ class Generator
|
||||
|
||||
// @see https://github.com/sebastianbergmann/phpunit/issues/2995
|
||||
if ($isInterface && $class->implementsInterface(\Throwable::class)) {
|
||||
$actualClassName = \Exception::class;
|
||||
$additionalInterfaces[] = $class->getName();
|
||||
$isInterface = false;
|
||||
|
||||
try {
|
||||
$class = new \ReflectionClass($actualClassName);
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new RuntimeException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($this->getInterfaceOwnMethods($mockClassName['fullClassName']) as $method) {
|
||||
$methodName = $method->getName();
|
||||
|
||||
if ($class->hasMethod($methodName)) {
|
||||
try {
|
||||
$classMethod = $class->getMethod($methodName);
|
||||
} catch (\ReflectionException $e) {
|
||||
throw new RuntimeException(
|
||||
$e->getMessage(),
|
||||
(int) $e->getCode(),
|
||||
$e
|
||||
);
|
||||
}
|
||||
|
||||
if (!$this->canMockMethod($classMethod)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$mockMethods->addMethods(
|
||||
MockMethod::fromReflection($method, $callOriginalMethods, $cloneArguments)
|
||||
);
|
||||
}
|
||||
|
||||
$mockClassName = $this->generateClassName(
|
||||
\Exception::class,
|
||||
$actualClassName,
|
||||
'',
|
||||
'Mock_'
|
||||
);
|
||||
|
||||
$class = new ReflectionClass($mockClassName['fullClassName']);
|
||||
}
|
||||
|
||||
// https://github.com/sebastianbergmann/phpunit-mock-objects/issues/103
|
||||
|
||||
@@ -12,11 +12,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke(
|
||||
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}
|
||||
)
|
||||
$__phpunit_invocation = new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}
|
||||
);
|
||||
|
||||
$__phpunit_invocation->setProxiedCall();
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke($__phpunit_invocation);
|
||||
|
||||
unset($__phpunit_invocation);
|
||||
|
||||
return call_user_func_array(array($this->__phpunit_originalObject, "{method_name}"), $__phpunit_arguments);
|
||||
}
|
||||
|
||||
@@ -12,11 +12,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke(
|
||||
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}
|
||||
)
|
||||
$__phpunit_invocation = new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'{class_name}', '{method_name}', $__phpunit_arguments, '{return_type}', $this, {clone_arguments}
|
||||
);
|
||||
|
||||
$__phpunit_invocation->setProxiedCall();
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke($__phpunit_invocation);
|
||||
|
||||
unset($__phpunit_invocation);
|
||||
|
||||
call_user_func_array(array($this->__phpunit_originalObject, "{method_name}"), $__phpunit_arguments);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,11 @@ class StaticInvocation implements Invocation, SelfDescribing
|
||||
*/
|
||||
private $isReturnTypeNullable = false;
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $proxiedCall = false;
|
||||
|
||||
/**
|
||||
* @param string $className
|
||||
* @param string $methodName
|
||||
@@ -138,7 +143,7 @@ class StaticInvocation implements Invocation, SelfDescribing
|
||||
*/
|
||||
public function generateReturnValue()
|
||||
{
|
||||
if ($this->isReturnTypeNullable) {
|
||||
if ($this->isReturnTypeNullable || $this->proxiedCall) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -186,6 +191,11 @@ class StaticInvocation implements Invocation, SelfDescribing
|
||||
}
|
||||
}
|
||||
|
||||
public function setProxiedCall(): void
|
||||
{
|
||||
$this->proxiedCall = true;
|
||||
}
|
||||
|
||||
public function toString(): string
|
||||
{
|
||||
$exporter = new Exporter;
|
||||
|
||||
@@ -25,7 +25,7 @@ use PHPUnit\Framework\MockObject\Stub\MatcherCollection;
|
||||
* Keeps track of all expectations and stubs as well as registering
|
||||
* identifications for builders.
|
||||
*/
|
||||
class InvocationMocker implements MatcherCollection, Invokable, NamespaceMatch
|
||||
class InvocationMocker implements Invokable, MatcherCollection, NamespaceMatch
|
||||
{
|
||||
/**
|
||||
* @var MatcherInvocation[]
|
||||
|
||||
@@ -53,7 +53,7 @@ use SebastianBergmann\ObjectEnumerator\Enumerator;
|
||||
use Text_Template;
|
||||
use Throwable;
|
||||
|
||||
abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
abstract class TestCase extends Assert implements SelfDescribing, Test
|
||||
{
|
||||
private const LOCALE_CATEGORIES = [\LC_ALL, \LC_COLLATE, \LC_CTYPE, \LC_MONETARY, \LC_NUMERIC, \LC_TIME];
|
||||
|
||||
@@ -118,12 +118,12 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
private $expectedException;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @var null|string
|
||||
*/
|
||||
private $expectedExceptionMessage;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
* @var null|string
|
||||
*/
|
||||
private $expectedExceptionMessageRegExp;
|
||||
|
||||
@@ -569,12 +569,12 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
return $this->expectedExceptionCode;
|
||||
}
|
||||
|
||||
public function getExpectedExceptionMessage(): string
|
||||
public function getExpectedExceptionMessage(): ?string
|
||||
{
|
||||
return $this->expectedExceptionMessage;
|
||||
}
|
||||
|
||||
public function getExpectedExceptionMessageRegExp(): string
|
||||
public function getExpectedExceptionMessageRegExp(): ?string
|
||||
{
|
||||
return $this->expectedExceptionMessageRegExp;
|
||||
}
|
||||
@@ -1723,22 +1723,11 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
}
|
||||
|
||||
if (!isset($passedKeys[$dependency])) {
|
||||
$this->status = BaseTestRunner::STATUS_SKIPPED;
|
||||
|
||||
$this->result->startTest($this);
|
||||
|
||||
$this->result->addError(
|
||||
$this,
|
||||
new SkippedTestError(
|
||||
\sprintf(
|
||||
'This test depends on "%s" to pass.',
|
||||
$dependency
|
||||
)
|
||||
),
|
||||
0
|
||||
);
|
||||
|
||||
$this->result->endTest($this, 0);
|
||||
if (!\is_callable($dependency, false, $callableName) || $dependency !== $callableName) {
|
||||
$this->markWarningForUncallableDependency($dependency);
|
||||
} else {
|
||||
$this->markSkippedForMissingDependecy($dependency);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1777,6 +1766,40 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
return true;
|
||||
}
|
||||
|
||||
private function markSkippedForMissingDependecy(string $dependency): void
|
||||
{
|
||||
$this->status = BaseTestRunner::STATUS_SKIPPED;
|
||||
$this->result->startTest($this);
|
||||
$this->result->addError(
|
||||
$this,
|
||||
new SkippedTestError(
|
||||
\sprintf(
|
||||
'This test depends on "%s" to pass.',
|
||||
$dependency
|
||||
)
|
||||
),
|
||||
0
|
||||
);
|
||||
$this->result->endTest($this, 0);
|
||||
}
|
||||
|
||||
private function markWarningForUncallableDependency(string $dependency): void
|
||||
{
|
||||
$this->status = BaseTestRunner::STATUS_WARNING;
|
||||
$this->result->startTest($this);
|
||||
$this->result->addWarning(
|
||||
$this,
|
||||
new Warning(
|
||||
\sprintf(
|
||||
'This test depends on "%s" which does not exist.',
|
||||
$dependency
|
||||
)
|
||||
),
|
||||
0
|
||||
);
|
||||
$this->result->endTest($this, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the mock object generator, creating it if it doesn't exist.
|
||||
*/
|
||||
|
||||
@@ -38,37 +38,37 @@ class TestResult implements Countable
|
||||
protected $passed = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var TestFailure[]
|
||||
*/
|
||||
protected $errors = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var TestFailure[]
|
||||
*/
|
||||
protected $failures = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var TestFailure[]
|
||||
*/
|
||||
protected $warnings = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var TestFailure[]
|
||||
*/
|
||||
protected $notImplemented = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var TestFailure[]
|
||||
*/
|
||||
protected $risky = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var TestFailure[]
|
||||
*/
|
||||
protected $skipped = [];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
* @var TestListener[]
|
||||
*/
|
||||
protected $listeners = [];
|
||||
|
||||
@@ -461,7 +461,9 @@ class TestResult implements Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Enumeration for the risky tests.
|
||||
* Returns an array of TestFailure objects for the risky tests
|
||||
*
|
||||
* @return TestFailure[]
|
||||
*/
|
||||
public function risky(): array
|
||||
{
|
||||
@@ -469,7 +471,9 @@ class TestResult implements Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Enumeration for the incomplete tests.
|
||||
* Returns an array of TestFailure objects for the incomplete tests
|
||||
*
|
||||
* @return TestFailure[]
|
||||
*/
|
||||
public function notImplemented(): array
|
||||
{
|
||||
@@ -493,7 +497,9 @@ class TestResult implements Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Enumeration for the skipped tests.
|
||||
* Returns an array of TestFailure objects for the skipped tests
|
||||
*
|
||||
* @return TestFailure[]
|
||||
*/
|
||||
public function skipped(): array
|
||||
{
|
||||
@@ -509,7 +515,9 @@ class TestResult implements Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Enumeration for the errors.
|
||||
* Returns an array of TestFailure objects for the errors
|
||||
*
|
||||
* @return TestFailure[]
|
||||
*/
|
||||
public function errors(): array
|
||||
{
|
||||
@@ -525,7 +533,9 @@ class TestResult implements Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Enumeration for the failures.
|
||||
* Returns an array of TestFailure objects for the failures
|
||||
*
|
||||
* @return TestFailure[]
|
||||
*/
|
||||
public function failures(): array
|
||||
{
|
||||
@@ -541,7 +551,9 @@ class TestResult implements Countable
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Enumeration for the warnings.
|
||||
* Returns an array of TestFailure objects for the warnings
|
||||
*
|
||||
* @return TestFailure[]
|
||||
*/
|
||||
public function warnings(): array
|
||||
{
|
||||
@@ -1068,7 +1080,12 @@ class TestResult implements Countable
|
||||
*/
|
||||
public function wasSuccessful(): bool
|
||||
{
|
||||
return empty($this->errors) && empty($this->failures) && empty($this->warnings);
|
||||
return $this->wasSuccessfulIgnoringWarnings() && empty($this->warnings);
|
||||
}
|
||||
|
||||
public function wasSuccessfulIgnoringWarnings(): bool
|
||||
{
|
||||
return empty($this->errors) && empty($this->failures);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@ use Throwable;
|
||||
/**
|
||||
* A TestSuite is a composite of Tests. It runs a collection of test cases.
|
||||
*/
|
||||
class TestSuite implements Test, SelfDescribing, IteratorAggregate
|
||||
class TestSuite implements IteratorAggregate, SelfDescribing, Test
|
||||
{
|
||||
/**
|
||||
* Enable or disable the backup and restoration of the $GLOBALS array.
|
||||
@@ -339,7 +339,7 @@ class TestSuite implements Test, SelfDescribing, IteratorAggregate
|
||||
$argumentsValid = true;
|
||||
} elseif (\is_string($theClass) &&
|
||||
$theClass !== '' &&
|
||||
\class_exists($theClass, false)) {
|
||||
\class_exists($theClass, true)) {
|
||||
$argumentsValid = true;
|
||||
|
||||
if ($name == '') {
|
||||
@@ -358,9 +358,9 @@ class TestSuite implements Test, SelfDescribing, IteratorAggregate
|
||||
}
|
||||
|
||||
if (!$theClass->isSubclassOf(TestCase::class)) {
|
||||
throw new Exception(
|
||||
'Class "' . $theClass->name . '" does not extend PHPUnit\Framework\TestCase.'
|
||||
);
|
||||
$this->setName($theClass);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($name != '') {
|
||||
@@ -703,10 +703,10 @@ class TestSuite implements Test, SelfDescribing, IteratorAggregate
|
||||
\call_user_func([$this->name, $beforeClassMethod]);
|
||||
}
|
||||
}
|
||||
} catch (SkippedTestSuiteError $e) {
|
||||
} catch (SkippedTestSuiteError $error) {
|
||||
foreach ($this->tests() as $test) {
|
||||
$result->startTest($test);
|
||||
$result->addFailure($test, $e, 0);
|
||||
$result->addFailure($test, $error, 0);
|
||||
$result->endTest($test, 0);
|
||||
}
|
||||
|
||||
@@ -746,10 +746,25 @@ class TestSuite implements Test, SelfDescribing, IteratorAggregate
|
||||
$test->run($result);
|
||||
}
|
||||
|
||||
foreach ($hookMethods['afterClass'] as $afterClassMethod) {
|
||||
if ($this->testCase === true && \class_exists($this->name, false) && \method_exists($this->name, $afterClassMethod)) {
|
||||
\call_user_func([$this->name, $afterClassMethod]);
|
||||
try {
|
||||
foreach ($hookMethods['afterClass'] as $afterClassMethod) {
|
||||
if ($this->testCase === true && \class_exists($this->name, false) && \method_exists(
|
||||
$this->name,
|
||||
$afterClassMethod
|
||||
)) {
|
||||
\call_user_func([$this->name, $afterClassMethod]);
|
||||
}
|
||||
}
|
||||
} catch (Throwable $t) {
|
||||
$message = "Exception in {$this->name}::$afterClassMethod" . \PHP_EOL . $t->getMessage();
|
||||
$error = new SyntheticError($message, 0, $t->getFile(), $t->getLine(), $t->getTrace());
|
||||
|
||||
$placeholderTest = clone $test;
|
||||
$placeholderTest->setName($afterClassMethod);
|
||||
|
||||
$result->startTest($placeholderTest);
|
||||
$result->addFailure($placeholderTest, $error, 0);
|
||||
$result->endTest($placeholderTest, 0);
|
||||
}
|
||||
|
||||
$this->tearDown();
|
||||
|
||||
@@ -25,7 +25,7 @@ abstract class GroupFilterIterator extends RecursiveFilterIterator
|
||||
parent::__construct($iterator);
|
||||
|
||||
foreach ($suite->getGroupDetails() as $group => $tests) {
|
||||
if (\in_array($group, $groups, true)) {
|
||||
if (\in_array((string) $group, $groups, true)) {
|
||||
$testHashes = \array_map(
|
||||
'spl_object_hash',
|
||||
$tests
|
||||
|
||||
@@ -24,7 +24,7 @@ use Throwable;
|
||||
/**
|
||||
* Runner for PHPT test cases.
|
||||
*/
|
||||
class PhptTestCase implements Test, SelfDescribing
|
||||
class PhptTestCase implements SelfDescribing, Test
|
||||
{
|
||||
/**
|
||||
* @var string[]
|
||||
@@ -109,13 +109,21 @@ class PhptTestCase implements Test, SelfDescribing
|
||||
*/
|
||||
public function run(TestResult $result = null): TestResult
|
||||
{
|
||||
$sections = $this->parse();
|
||||
$code = $this->render($sections['FILE']);
|
||||
|
||||
if ($result === null) {
|
||||
$result = new TestResult;
|
||||
}
|
||||
|
||||
try {
|
||||
$sections = $this->parse();
|
||||
} catch (Exception $e) {
|
||||
$result->startTest($this);
|
||||
$result->addFailure($this, new SkippedTestError($e->getMessage()), 0);
|
||||
$result->endTest($this, 0);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
$code = $this->render($sections['FILE']);
|
||||
$xfail = false;
|
||||
$settings = $this->parseIniSection(self::SETTINGS);
|
||||
|
||||
@@ -383,7 +391,7 @@ class PhptTestCase implements Test, SelfDescribing
|
||||
}
|
||||
|
||||
if (empty($section)) {
|
||||
throw new Exception('Invalid PHPT file');
|
||||
throw new Exception('Invalid PHPT file: empty section header');
|
||||
}
|
||||
|
||||
$sections[$section] .= $line;
|
||||
@@ -403,7 +411,7 @@ class PhptTestCase implements Test, SelfDescribing
|
||||
foreach ($unsupportedSections as $section) {
|
||||
if (isset($sections[$section])) {
|
||||
throw new Exception(
|
||||
'PHPUnit does not support this PHPT file'
|
||||
"PHPUnit does not support PHPT $section sections"
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -535,7 +543,7 @@ class PhptTestCase implements Test, SelfDescribing
|
||||
if (!empty($GLOBALS['__PHPUNIT_BOOTSTRAP'])) {
|
||||
$globals = '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = ' . \var_export(
|
||||
$GLOBALS['__PHPUNIT_BOOTSTRAP'],
|
||||
true
|
||||
true
|
||||
) . ";\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
namespace PHPUnit\Runner;
|
||||
|
||||
final class ResultCacheExtension implements AfterSuccessfulTestHook, AfterSkippedTestHook, AfterRiskyTestHook, AfterIncompleteTestHook, AfterTestErrorHook, AfterTestWarningHook, AfterTestFailureHook, AfterLastTestHook
|
||||
final class ResultCacheExtension implements AfterIncompleteTestHook, AfterLastTestHook, AfterRiskyTestHook, AfterSkippedTestHook, AfterSuccessfulTestHook, AfterTestErrorHook, AfterTestFailureHook, AfterTestWarningHook
|
||||
{
|
||||
/**
|
||||
* @var TestResultCacheInterface
|
||||
|
||||
@@ -30,7 +30,7 @@ class Version
|
||||
}
|
||||
|
||||
if (self::$version === null) {
|
||||
$version = new VersionId('7.5.1', \dirname(__DIR__, 2));
|
||||
$version = new VersionId('7.5.11', \dirname(__DIR__, 2));
|
||||
self::$version = $version->getVersion();
|
||||
}
|
||||
|
||||
|
||||
12
vendor/phpunit/phpunit/src/TextUI/Command.php
vendored
12
vendor/phpunit/phpunit/src/TextUI/Command.php
vendored
@@ -778,7 +778,17 @@ class Command
|
||||
}
|
||||
|
||||
if (isset($this->options[1][1])) {
|
||||
$this->arguments['testFile'] = \realpath($this->options[1][1]);
|
||||
$testFile = \realpath($this->options[1][1]);
|
||||
|
||||
if ($testFile === false) {
|
||||
$this->exitWithErrorMessage(
|
||||
\sprintf(
|
||||
'Cannot open file "%s".',
|
||||
$this->options[1][1]
|
||||
)
|
||||
);
|
||||
}
|
||||
$this->arguments['testFile'] = $testFile;
|
||||
} else {
|
||||
$this->arguments['testFile'] = '';
|
||||
}
|
||||
|
||||
165
vendor/phpunit/phpunit/src/TextUI/TestRunner.php
vendored
165
vendor/phpunit/phpunit/src/TextUI/TestRunner.php
vendored
@@ -36,6 +36,7 @@ use PHPUnit\Runner\TestSuiteLoader;
|
||||
use PHPUnit\Runner\TestSuiteSorter;
|
||||
use PHPUnit\Runner\Version;
|
||||
use PHPUnit\Util\Configuration;
|
||||
use PHPUnit\Util\Filesystem;
|
||||
use PHPUnit\Util\Log\JUnit;
|
||||
use PHPUnit\Util\Log\TeamCity;
|
||||
use PHPUnit\Util\Printer;
|
||||
@@ -187,12 +188,23 @@ class TestRunner extends BaseTestRunner
|
||||
}
|
||||
|
||||
if ($arguments['cacheResult']) {
|
||||
if (isset($arguments['cacheResultFile'])) {
|
||||
$cache = new TestResultCache($arguments['cacheResultFile']);
|
||||
} else {
|
||||
$cache = new TestResultCache;
|
||||
if (!isset($arguments['cacheResultFile'])) {
|
||||
if ($arguments['configuration'] instanceof Configuration) {
|
||||
$cacheLocation = $arguments['configuration']->getFilename();
|
||||
} else {
|
||||
$cacheLocation = $_SERVER['PHP_SELF'];
|
||||
}
|
||||
|
||||
$arguments['cacheResultFile'] = null;
|
||||
|
||||
$cacheResultFile = \realpath($cacheLocation);
|
||||
|
||||
if ($cacheResultFile !== false) {
|
||||
$arguments['cacheResultFile'] = \dirname($cacheResultFile);
|
||||
}
|
||||
}
|
||||
|
||||
$cache = new TestResultCache($arguments['cacheResultFile']);
|
||||
$this->extensions[] = new ResultCacheExtension($cache);
|
||||
}
|
||||
|
||||
@@ -337,13 +349,6 @@ class TestRunner extends BaseTestRunner
|
||||
|
||||
$this->writeMessage('Runtime', $runtime);
|
||||
|
||||
if ($arguments['executionOrder'] === TestSuiteSorter::ORDER_RANDOMIZED) {
|
||||
$this->writeMessage(
|
||||
'Random seed',
|
||||
$arguments['randomOrderSeed']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($arguments['configuration'])) {
|
||||
$this->writeMessage(
|
||||
'Configuration',
|
||||
@@ -366,6 +371,13 @@ class TestRunner extends BaseTestRunner
|
||||
}
|
||||
}
|
||||
|
||||
if ($arguments['executionOrder'] === TestSuiteSorter::ORDER_RANDOMIZED) {
|
||||
$this->writeMessage(
|
||||
'Random seed',
|
||||
$arguments['randomOrderSeed']
|
||||
);
|
||||
}
|
||||
|
||||
if (isset($tooFewColumnsRequested)) {
|
||||
$this->writeMessage('Error', 'Less than 16 columns requested, number of columns set to 16');
|
||||
}
|
||||
@@ -477,6 +489,51 @@ class TestRunner extends BaseTestRunner
|
||||
}
|
||||
|
||||
if ($codeCoverageReports > 0 || isset($arguments['xdebugFilterFile'])) {
|
||||
$whitelistFromConfigurationFile = false;
|
||||
$whitelistFromOption = false;
|
||||
|
||||
if (isset($arguments['whitelist'])) {
|
||||
$this->codeCoverageFilter->addDirectoryToWhitelist($arguments['whitelist']);
|
||||
|
||||
$whitelistFromOption = true;
|
||||
}
|
||||
|
||||
if (isset($arguments['configuration'])) {
|
||||
$filterConfiguration = $arguments['configuration']->getFilterConfiguration();
|
||||
|
||||
if (!empty($filterConfiguration['whitelist'])) {
|
||||
$whitelistFromConfigurationFile = true;
|
||||
}
|
||||
|
||||
if (!empty($filterConfiguration['whitelist'])) {
|
||||
foreach ($filterConfiguration['whitelist']['include']['directory'] as $dir) {
|
||||
$this->codeCoverageFilter->addDirectoryToWhitelist(
|
||||
$dir['path'],
|
||||
$dir['suffix'],
|
||||
$dir['prefix']
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($filterConfiguration['whitelist']['include']['file'] as $file) {
|
||||
$this->codeCoverageFilter->addFileToWhitelist($file);
|
||||
}
|
||||
|
||||
foreach ($filterConfiguration['whitelist']['exclude']['directory'] as $dir) {
|
||||
$this->codeCoverageFilter->removeDirectoryFromWhitelist(
|
||||
$dir['path'],
|
||||
$dir['suffix'],
|
||||
$dir['prefix']
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($filterConfiguration['whitelist']['exclude']['file'] as $file) {
|
||||
$this->codeCoverageFilter->removeFileFromWhitelist($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($codeCoverageReports > 0) {
|
||||
$codeCoverage = new CodeCoverage(
|
||||
null,
|
||||
$this->codeCoverageFilter
|
||||
@@ -510,66 +567,14 @@ class TestRunner extends BaseTestRunner
|
||||
$codeCoverage->setDisableIgnoredLines(true);
|
||||
}
|
||||
|
||||
$whitelistFromConfigurationFile = false;
|
||||
$whitelistFromOption = false;
|
||||
if (!empty($filterConfiguration['whitelist'])) {
|
||||
$codeCoverage->setAddUncoveredFilesFromWhitelist(
|
||||
$filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist']
|
||||
);
|
||||
|
||||
if (isset($arguments['whitelist'])) {
|
||||
$this->codeCoverageFilter->addDirectoryToWhitelist($arguments['whitelist']);
|
||||
|
||||
$whitelistFromOption = true;
|
||||
}
|
||||
|
||||
if (isset($arguments['configuration'])) {
|
||||
$filterConfiguration = $arguments['configuration']->getFilterConfiguration();
|
||||
|
||||
if (!empty($filterConfiguration['whitelist'])) {
|
||||
$whitelistFromConfigurationFile = true;
|
||||
}
|
||||
|
||||
if (!empty($filterConfiguration['whitelist'])) {
|
||||
$codeCoverage->setAddUncoveredFilesFromWhitelist(
|
||||
$filterConfiguration['whitelist']['addUncoveredFilesFromWhitelist']
|
||||
);
|
||||
|
||||
$codeCoverage->setProcessUncoveredFilesFromWhitelist(
|
||||
$filterConfiguration['whitelist']['processUncoveredFilesFromWhitelist']
|
||||
);
|
||||
|
||||
foreach ($filterConfiguration['whitelist']['include']['directory'] as $dir) {
|
||||
$this->codeCoverageFilter->addDirectoryToWhitelist(
|
||||
$dir['path'],
|
||||
$dir['suffix'],
|
||||
$dir['prefix']
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($filterConfiguration['whitelist']['include']['file'] as $file) {
|
||||
$this->codeCoverageFilter->addFileToWhitelist($file);
|
||||
}
|
||||
|
||||
foreach ($filterConfiguration['whitelist']['exclude']['directory'] as $dir) {
|
||||
$this->codeCoverageFilter->removeDirectoryFromWhitelist(
|
||||
$dir['path'],
|
||||
$dir['suffix'],
|
||||
$dir['prefix']
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($filterConfiguration['whitelist']['exclude']['file'] as $file) {
|
||||
$this->codeCoverageFilter->removeFileFromWhitelist($file);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arguments['xdebugFilterFile'], $filterConfiguration)) {
|
||||
$filterScriptGenerator = new XdebugFilterScriptGenerator;
|
||||
$script = $filterScriptGenerator->generate($filterConfiguration['whitelist']);
|
||||
\file_put_contents($arguments['xdebugFilterFile'], $script);
|
||||
|
||||
$this->write("\n");
|
||||
$this->write(\sprintf('Wrote Xdebug filter script to %s ' . \PHP_EOL, $arguments['xdebugFilterFile']));
|
||||
|
||||
exit(self::SUCCESS_EXIT);
|
||||
$codeCoverage->setProcessUncoveredFilesFromWhitelist(
|
||||
$filterConfiguration['whitelist']['processUncoveredFilesFromWhitelist']
|
||||
);
|
||||
}
|
||||
|
||||
if (!$this->codeCoverageFilter->hasWhitelist()) {
|
||||
@@ -585,6 +590,24 @@ class TestRunner extends BaseTestRunner
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($arguments['xdebugFilterFile'], $filterConfiguration)) {
|
||||
$this->write("\n");
|
||||
|
||||
$script = (new XdebugFilterScriptGenerator)->generate($filterConfiguration['whitelist']);
|
||||
|
||||
if ($arguments['xdebugFilterFile'] !== 'php://stdout' && $arguments['xdebugFilterFile'] !== 'php://stderr' && !Filesystem::createDirectory(\dirname($arguments['xdebugFilterFile']))) {
|
||||
$this->write(\sprintf('Cannot write Xdebug filter script to %s ' . \PHP_EOL, $arguments['xdebugFilterFile']));
|
||||
|
||||
exit(self::EXCEPTION_EXIT);
|
||||
}
|
||||
|
||||
\file_put_contents($arguments['xdebugFilterFile'], $script);
|
||||
|
||||
$this->write(\sprintf('Wrote Xdebug filter script to %s ' . \PHP_EOL, $arguments['xdebugFilterFile']));
|
||||
|
||||
exit(self::SUCCESS_EXIT);
|
||||
}
|
||||
|
||||
$this->printer->write("\n");
|
||||
|
||||
if (isset($codeCoverage)) {
|
||||
@@ -762,7 +785,7 @@ class TestRunner extends BaseTestRunner
|
||||
}
|
||||
|
||||
if ($exit) {
|
||||
if ($result->wasSuccessful()) {
|
||||
if ($result->wasSuccessfulIgnoringWarnings()) {
|
||||
if ($arguments['failOnRisky'] && !$result->allHarmless()) {
|
||||
exit(self::FAILURE_EXIT);
|
||||
}
|
||||
|
||||
115
vendor/phpunit/phpunit/src/Util/Blacklist.php
vendored
115
vendor/phpunit/phpunit/src/Util/Blacklist.php
vendored
@@ -12,13 +12,17 @@ namespace PHPUnit\Util;
|
||||
use Composer\Autoload\ClassLoader;
|
||||
use DeepCopy\DeepCopy;
|
||||
use Doctrine\Instantiator\Instantiator;
|
||||
use PharIo\Manifest\Manifest;
|
||||
use PharIo\Version\Version as PharIoVersion;
|
||||
use PHP_Token;
|
||||
use phpDocumentor\Reflection\DocBlock;
|
||||
use PHPUnit\Framework\MockObject\Generator;
|
||||
use phpDocumentor\Reflection\Project;
|
||||
use phpDocumentor\Reflection\Type;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Prophet;
|
||||
use ReflectionClass;
|
||||
use SebastianBergmann\CodeCoverage\CodeCoverage;
|
||||
use SebastianBergmann\CodeUnitReverseLookup\Wizard;
|
||||
use SebastianBergmann\Comparator\Comparator;
|
||||
use SebastianBergmann\Diff\Diff;
|
||||
use SebastianBergmann\Environment\Runtime;
|
||||
@@ -26,10 +30,14 @@ use SebastianBergmann\Exporter\Exporter;
|
||||
use SebastianBergmann\FileIterator\Facade as FileIteratorFacade;
|
||||
use SebastianBergmann\GlobalState\Snapshot;
|
||||
use SebastianBergmann\Invoker\Invoker;
|
||||
use SebastianBergmann\ObjectEnumerator\Enumerator;
|
||||
use SebastianBergmann\RecursionContext\Context;
|
||||
use SebastianBergmann\ResourceOperations\ResourceOperations;
|
||||
use SebastianBergmann\Timer\Timer;
|
||||
use SebastianBergmann\Version;
|
||||
use Text_Template;
|
||||
use TheSeer\Tokenizer\Tokenizer;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
/**
|
||||
* Utility class for blacklisting PHPUnit's own source code files.
|
||||
@@ -40,28 +48,89 @@ final class Blacklist
|
||||
* @var array
|
||||
*/
|
||||
public static $blacklistedClassNames = [
|
||||
FileIteratorFacade::class => 1,
|
||||
Timer::class => 1,
|
||||
PHP_Token::class => 1,
|
||||
TestCase::class => 2,
|
||||
'PHPUnit\DbUnit\TestCase' => 2,
|
||||
Generator::class => 1,
|
||||
Text_Template::class => 1,
|
||||
'Symfony\Component\Yaml\Yaml' => 1,
|
||||
CodeCoverage::class => 1,
|
||||
Diff::class => 1,
|
||||
Runtime::class => 1,
|
||||
Comparator::class => 1,
|
||||
Exporter::class => 1,
|
||||
Snapshot::class => 1,
|
||||
Invoker::class => 1,
|
||||
Context::class => 1,
|
||||
Version::class => 1,
|
||||
ClassLoader::class => 1,
|
||||
Instantiator::class => 1,
|
||||
DocBlock::class => 1,
|
||||
Prophet::class => 1,
|
||||
DeepCopy::class => 1,
|
||||
// composer
|
||||
ClassLoader::class => 1,
|
||||
|
||||
// doctrine/instantiator
|
||||
Instantiator::class => 1,
|
||||
|
||||
// myclabs/deepcopy
|
||||
DeepCopy::class => 1,
|
||||
|
||||
// phar-io/manifest
|
||||
Manifest::class => 1,
|
||||
|
||||
// phar-io/version
|
||||
PharIoVersion::class => 1,
|
||||
|
||||
// phpdocumentor/reflection-common
|
||||
Project::class => 1,
|
||||
|
||||
// phpdocumentor/reflection-docblock
|
||||
DocBlock::class => 1,
|
||||
|
||||
// phpdocumentor/type-resolver
|
||||
Type::class => 1,
|
||||
|
||||
// phpspec/prophecy
|
||||
Prophet::class => 1,
|
||||
|
||||
// phpunit/phpunit
|
||||
TestCase::class => 2,
|
||||
|
||||
// phpunit/php-code-coverage
|
||||
CodeCoverage::class => 1,
|
||||
|
||||
// phpunit/php-file-iterator
|
||||
FileIteratorFacade::class => 1,
|
||||
|
||||
// phpunit/php-invoker
|
||||
Invoker::class => 1,
|
||||
|
||||
// phpunit/php-text-template
|
||||
Text_Template::class => 1,
|
||||
|
||||
// phpunit/php-timer
|
||||
Timer::class => 1,
|
||||
|
||||
// phpunit/php-token-stream
|
||||
PHP_Token::class => 1,
|
||||
|
||||
// sebastian/code-unit-reverse-lookup
|
||||
Wizard::class => 1,
|
||||
|
||||
// sebastian/comparator
|
||||
Comparator::class => 1,
|
||||
|
||||
// sebastian/diff
|
||||
Diff::class => 1,
|
||||
|
||||
// sebastian/environment
|
||||
Runtime::class => 1,
|
||||
|
||||
// sebastian/exporter
|
||||
Exporter::class => 1,
|
||||
|
||||
// sebastian/global-state
|
||||
Snapshot::class => 1,
|
||||
|
||||
// sebastian/object-enumerator
|
||||
Enumerator::class => 1,
|
||||
|
||||
// sebastian/recursion-context
|
||||
Context::class => 1,
|
||||
|
||||
// sebastian/resource-operations
|
||||
ResourceOperations::class => 1,
|
||||
|
||||
// sebastian/version
|
||||
Version::class => 1,
|
||||
|
||||
// theseer/tokenizer
|
||||
Tokenizer::class => 1,
|
||||
|
||||
// webmozart/assert
|
||||
Assert::class => 1,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,4 +27,9 @@ final class Filesystem
|
||||
$className
|
||||
) . '.php';
|
||||
}
|
||||
|
||||
public static function createDirectory(string $directory): bool
|
||||
{
|
||||
return !(!\is_dir($directory) && !@\mkdir($directory, 0777, true) && !\is_dir($directory));
|
||||
}
|
||||
}
|
||||
|
||||
7
vendor/phpunit/phpunit/src/Util/Printer.php
vendored
7
vendor/phpunit/phpunit/src/Util/Printer.php
vendored
@@ -53,7 +53,7 @@ class Printer
|
||||
|
||||
$this->out = \fsockopen($out[0], $out[1]);
|
||||
} else {
|
||||
if (\strpos($out, 'php://') === false && !$this->createDirectory(\dirname($out))) {
|
||||
if (\strpos($out, 'php://') === false && !Filesystem::createDirectory(\dirname($out))) {
|
||||
throw new Exception(\sprintf('Directory "%s" was not created', \dirname($out)));
|
||||
}
|
||||
|
||||
@@ -132,9 +132,4 @@ class Printer
|
||||
{
|
||||
$this->autoFlush = $autoFlush;
|
||||
}
|
||||
|
||||
private function createDirectory(string $directory): bool
|
||||
{
|
||||
return !(!\is_dir($directory) && !@\mkdir($directory, 0777, true) && !\is_dir($directory));
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/phpunit/phpunit/src/Util/Test.php
vendored
2
vendor/phpunit/phpunit/src/Util/Test.php
vendored
@@ -88,7 +88,7 @@ final class Test
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private const REGEX_REQUIRES = '/@requires\s+(?P<name>function|extension)\s+(?P<value>([^ ]+?))\s*(?P<operator>[<>=!]{0,2})\s*(?P<version>[\d\.-]+[\d\.]?)?[ \t]*\r?$/m';
|
||||
private const REGEX_REQUIRES = '/@requires\s+(?P<name>function|extension)\s+(?P<value>([^\s<>=!]+))\s*(?P<operator>[<>=!]{0,2})\s*(?P<version>[\d\.-]+[\d\.]?)?[ \t]*\r?$/m';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
||||
@@ -172,11 +172,11 @@ class XmlResultPrinter extends Printer implements TestListener
|
||||
|
||||
if (isset($inlineAnnotations['given'], $inlineAnnotations['when'], $inlineAnnotations['then'])) {
|
||||
$node->setAttribute('given', $inlineAnnotations['given']['value']);
|
||||
$node->setAttribute('givenStartLine', $inlineAnnotations['given']['line']);
|
||||
$node->setAttribute('givenStartLine', (string) $inlineAnnotations['given']['line']);
|
||||
$node->setAttribute('when', $inlineAnnotations['when']['value']);
|
||||
$node->setAttribute('whenStartLine', $inlineAnnotations['when']['line']);
|
||||
$node->setAttribute('whenStartLine', (string) $inlineAnnotations['when']['line']);
|
||||
$node->setAttribute('then', $inlineAnnotations['then']['value']);
|
||||
$node->setAttribute('thenStartLine', $inlineAnnotations['then']['line']);
|
||||
$node->setAttribute('thenStartLine', (string) $inlineAnnotations['then']['line']);
|
||||
}
|
||||
|
||||
if ($this->exception !== null) {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
namespace PHPUnit\Runner;
|
||||
|
||||
use PHPUnit\Framework\Test;
|
||||
use PHPUnit\Util\Filesystem;
|
||||
|
||||
class TestResultCache implements \Serializable, TestResultCacheInterface
|
||||
{
|
||||
@@ -63,9 +64,14 @@ class TestResultCache implements \Serializable, TestResultCacheInterface
|
||||
*/
|
||||
private $times = [];
|
||||
|
||||
public function __construct($filename = null)
|
||||
public function __construct($filepath = null)
|
||||
{
|
||||
$this->cacheFilename = $filename ?? $_ENV['PHPUNIT_RESULT_CACHE'] ?? self::DEFAULT_RESULT_CACHE_FILENAME;
|
||||
if ($filepath !== null && \is_dir($filepath)) {
|
||||
// cache path provided, use default cache filename in that location
|
||||
$filepath = $filepath . \DIRECTORY_SEPARATOR . self::DEFAULT_RESULT_CACHE_FILENAME;
|
||||
}
|
||||
|
||||
$this->cacheFilename = $filepath ?? $_ENV['PHPUNIT_RESULT_CACHE'] ?? self::DEFAULT_RESULT_CACHE_FILENAME;
|
||||
}
|
||||
|
||||
public function persist(): void
|
||||
@@ -79,7 +85,7 @@ class TestResultCache implements \Serializable, TestResultCacheInterface
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->createDirectory(\dirname($this->cacheFilename))) {
|
||||
if (!Filesystem::createDirectory(\dirname($this->cacheFilename))) {
|
||||
throw new Exception(
|
||||
\sprintf(
|
||||
'Cannot create directory "%s" for result cache file',
|
||||
@@ -187,9 +193,4 @@ class TestResultCache implements \Serializable, TestResultCacheInterface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function createDirectory(string $directory): bool
|
||||
{
|
||||
return !(!\is_dir($directory) && !@\mkdir($directory, 0777, true) && !\is_dir($directory));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,11 @@ EOF;
|
||||
|
||||
if (isset($filterData['include']['directory'])) {
|
||||
foreach ($filterData['include']['directory'] as $directory) {
|
||||
$files[] = $directory['path'];
|
||||
$path = \realpath($directory['path']);
|
||||
|
||||
if (\is_string($path)) {
|
||||
$files[] = \sprintf('%s/', $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,4 +39,17 @@ class DependencyFailureTest extends TestCase
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This test has been added to check the printed warnings for the user
|
||||
* when a dependency simply doesn't exist.
|
||||
*
|
||||
* @depends doesNotExist
|
||||
*
|
||||
* @see https://github.com/sebastianbergmann/phpunit/issues/3517
|
||||
*/
|
||||
public function testHandlesDependsAnnotationForNonexistentTests(): void
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class ExceptionInTearDownTest extends TestCase
|
||||
{
|
||||
$this->tearDown = true;
|
||||
|
||||
throw new Exception;
|
||||
throw new Exception('throw Exception in tearDown()');
|
||||
}
|
||||
|
||||
public function testSomething(): void
|
||||
|
||||
@@ -9,4 +9,5 @@
|
||||
*/
|
||||
interface ExceptionWithThrowable extends \Throwable
|
||||
{
|
||||
public function getAdditionalInformation();
|
||||
}
|
||||
|
||||
@@ -7,11 +7,14 @@
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
function functionCallback()
|
||||
class FunctionCallbackWrapper
|
||||
{
|
||||
$args = \func_get_args();
|
||||
public static function functionCallback()
|
||||
{
|
||||
$args = \func_get_args();
|
||||
|
||||
if ($args == ['foo', 'bar']) {
|
||||
return 'pass';
|
||||
if ($args == ['foo', 'bar']) {
|
||||
return 'pass';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,15 @@ class RequirementsTest extends TestCase
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires function testFunc2
|
||||
*
|
||||
* @see https://github.com/sebastianbergmann/phpunit/issues/3459
|
||||
*/
|
||||
public function testRequiresFunctionWithDigit(): void
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @requires extension testExt
|
||||
*/
|
||||
@@ -92,9 +101,9 @@ class RequirementsTest extends TestCase
|
||||
* @requires PHPUnit 9-dev
|
||||
* @requires OS DOESNOTEXIST
|
||||
* @requires function testFuncOne
|
||||
* @requires function testFuncTwo
|
||||
* @requires function testFunc2
|
||||
* @requires extension testExtOne
|
||||
* @requires extension testExtTwo
|
||||
* @requires extension testExt2
|
||||
* @requires extension testExtThree 2.0
|
||||
* @requires setting not_a_setting Off
|
||||
*/
|
||||
|
||||
39
vendor/phpunit/phpunit/tests/bootstrap.php
vendored
39
vendor/phpunit/phpunit/tests/bootstrap.php
vendored
@@ -15,42 +15,3 @@ if (!\defined('TEST_FILES_PATH')) {
|
||||
\ini_set('serialize_precision', 14);
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
// TODO: Figure out why these are required (the classes should be autoloaded instead)
|
||||
require_once TEST_FILES_PATH . 'BeforeAndAfterTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'BeforeClassAndAfterClassTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'TestWithTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'BeforeClassWithOnlyDataProviderTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'DataProviderSkippedTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'DataProviderDependencyTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'DataProviderIncompleteTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'InheritedTestCase.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'NoTestCaseClass.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'NoTestCases.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'NotPublicTestCase.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'NotSelfDescribingTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'NotVoidTestCase.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'OverrideTestCase.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'RequirementsClassBeforeClassHookTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'NoArgTestCaseTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'Singleton.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'DoNoAssertionTestCase.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'FunctionCallback.php';
|
||||
|
||||
@@ -21,7 +21,7 @@ use PHPUnit\Runner\AfterTestWarningHook;
|
||||
use PHPUnit\Runner\BeforeFirstTestHook;
|
||||
use PHPUnit\Runner\BeforeTestHook;
|
||||
|
||||
final class Extension implements BeforeFirstTestHook, BeforeTestHook, AfterTestHook, AfterSuccessfulTestHook, AfterSkippedTestHook, AfterRiskyTestHook, AfterIncompleteTestHook, AfterTestErrorHook, AfterTestWarningHook, AfterTestFailureHook, AfterLastTestHook
|
||||
final class Extension implements AfterIncompleteTestHook, AfterLastTestHook, AfterRiskyTestHook, AfterSkippedTestHook, AfterSuccessfulTestHook, AfterTestErrorHook, AfterTestFailureHook, AfterTestHook, AfterTestWarningHook, BeforeFirstTestHook, BeforeTestHook
|
||||
{
|
||||
private $amountOfInjectedArguments = 0;
|
||||
|
||||
|
||||
12
vendor/phpunit/phpunit/tests/end-to-end/cli/test-file-not-found.phpt
vendored
Normal file
12
vendor/phpunit/phpunit/tests/end-to-end/cli/test-file-not-found.phpt
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
--TEST--
|
||||
Test incorrect testFile is reported
|
||||
--ARGS--
|
||||
--no-configuration tests nonExistingFile.php
|
||||
--FILE--
|
||||
<?php declare(strict_types=1);
|
||||
require __DIR__ . '/../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
Cannot open file "nonExistingFile.php".
|
||||
@@ -15,10 +15,17 @@ PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
Runtime: %s
|
||||
|
||||
...FSSS 7 / 7 (100%)
|
||||
...FSSSW 8 / 8 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 warning:
|
||||
|
||||
1) DependencyFailureTest::testHandlesDependsAnnotationForNonexistentTests
|
||||
This test depends on "DependencyFailureTest::doesNotExist" which does not exist.
|
||||
|
||||
--
|
||||
|
||||
There was 1 failure:
|
||||
|
||||
1) DependencyFailureTest::testOne
|
||||
@@ -39,4 +46,4 @@ This test depends on "DependencyFailureTest::testTwo" to pass.
|
||||
This test depends on "DependencyFailureTest::testOne" to pass.
|
||||
|
||||
FAILURES!
|
||||
Tests: 7, Assertions: 4, Failures: 1, Skipped: 3.
|
||||
Tests: 8, Assertions: 4, Failures: 1, Warnings: 1, Skipped: 3.
|
||||
|
||||
@@ -14,10 +14,17 @@ PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
Runtime: %s
|
||||
|
||||
...FSSS 7 / 7 (100%)
|
||||
...FSSSW 8 / 8 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There was 1 warning:
|
||||
|
||||
1) DependencyFailureTest::testHandlesDependsAnnotationForNonexistentTests
|
||||
This test depends on "DependencyFailureTest::doesNotExist" which does not exist.
|
||||
|
||||
--
|
||||
|
||||
There was 1 failure:
|
||||
|
||||
1) DependencyFailureTest::testOne
|
||||
@@ -38,4 +45,4 @@ This test depends on "DependencyFailureTest::testTwo" to pass.
|
||||
This test depends on "DependencyFailureTest::testOne" to pass.
|
||||
|
||||
FAILURES!
|
||||
Tests: 7, Assertions: 4, Failures: 1, Skipped: 3.
|
||||
Tests: 8, Assertions: 4, Failures: 1, Warnings: 1, Skipped: 3.
|
||||
|
||||
@@ -16,6 +16,7 @@ require __DIR__ . '/../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
<?php declare(strict_types=1);
|
||||
if (!\function_exists('xdebug_set_filter')) {
|
||||
return;
|
||||
@@ -28,5 +29,4 @@ if (!\function_exists('xdebug_set_filter')) {
|
||||
%s
|
||||
]
|
||||
);
|
||||
|
||||
Wrote Xdebug filter script to php://stderr
|
||||
|
||||
@@ -3,18 +3,21 @@ phpunit --group balanceIsInitiallyZero BankAccountTest ../../_files/BankAccountT
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--group';
|
||||
$_SERVER['argv'][3] = 'balanceIsInitiallyZero';
|
||||
$_SERVER['argv'][4] = 'BankAccountTest';
|
||||
$_SERVER['argv'][5] = __DIR__ . '/../_files/BankAccountTest.php';
|
||||
$_SERVER['argv'][2] = '--testdox';
|
||||
$_SERVER['argv'][3] = '--group';
|
||||
$_SERVER['argv'][4] = '3502';
|
||||
$_SERVER['argv'][5] = 'NumericGroupAnnotationTest';
|
||||
$_SERVER['argv'][6] = __DIR__ . '/../_files/NumericGroupAnnotationTest.php';
|
||||
|
||||
require __DIR__ . '/../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
. 1 / 1 (100%)
|
||||
NumericGroupAnnotation
|
||||
✔ Empty test for @ticket numeric annotation values
|
||||
✔ Empty test for @group numeric annotation values
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
OK (2 tests, 2 assertions)
|
||||
|
||||
@@ -49,12 +49,16 @@ class ProxyFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
|
||||
}
|
||||
}
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke(
|
||||
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'bar', $__phpunit_arguments, '', $this, true
|
||||
)
|
||||
$__phpunit_invocation = new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'bar', $__phpunit_arguments, '', $this, true
|
||||
);
|
||||
|
||||
$__phpunit_invocation->setProxiedCall();
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke($__phpunit_invocation);
|
||||
|
||||
unset($__phpunit_invocation);
|
||||
|
||||
return call_user_func_array(array($this->__phpunit_originalObject, "bar"), $__phpunit_arguments);
|
||||
}
|
||||
|
||||
@@ -71,12 +75,16 @@ class ProxyFoo extends Foo implements PHPUnit\Framework\MockObject\MockObject
|
||||
}
|
||||
}
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke(
|
||||
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'baz', $__phpunit_arguments, '', $this, true
|
||||
)
|
||||
$__phpunit_invocation = new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'baz', $__phpunit_arguments, '', $this, true
|
||||
);
|
||||
|
||||
$__phpunit_invocation->setProxiedCall();
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke($__phpunit_invocation);
|
||||
|
||||
unset($__phpunit_invocation);
|
||||
|
||||
return call_user_func_array(array($this->__phpunit_originalObject, "baz"), $__phpunit_arguments);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,11 +35,15 @@ print $code;
|
||||
}
|
||||
}
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke(
|
||||
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'bar', $__phpunit_arguments, '', $this, false
|
||||
)
|
||||
$__phpunit_invocation = new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'bar', $__phpunit_arguments, '', $this, false
|
||||
);
|
||||
|
||||
$__phpunit_invocation->setProxiedCall();
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke($__phpunit_invocation);
|
||||
|
||||
unset($__phpunit_invocation);
|
||||
|
||||
return call_user_func_array(array($this->__phpunit_originalObject, "bar"), $__phpunit_arguments);
|
||||
}
|
||||
|
||||
@@ -35,11 +35,15 @@ private function bar($arg)
|
||||
}
|
||||
}
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke(
|
||||
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'bar', $__phpunit_arguments, '', $this, false
|
||||
)
|
||||
$__phpunit_invocation = new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'bar', $__phpunit_arguments, '', $this, false
|
||||
);
|
||||
|
||||
$__phpunit_invocation->setProxiedCall();
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke($__phpunit_invocation);
|
||||
|
||||
unset($__phpunit_invocation);
|
||||
|
||||
return call_user_func_array(array($this->__phpunit_originalObject, "bar"), $__phpunit_arguments);
|
||||
}
|
||||
|
||||
@@ -35,11 +35,15 @@ private function bar(...$args)
|
||||
}
|
||||
}
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke(
|
||||
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'bar', $__phpunit_arguments, '', $this, false
|
||||
)
|
||||
$__phpunit_invocation = new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'bar', $__phpunit_arguments, '', $this, false
|
||||
);
|
||||
|
||||
$__phpunit_invocation->setProxiedCall();
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke($__phpunit_invocation);
|
||||
|
||||
unset($__phpunit_invocation);
|
||||
|
||||
return call_user_func_array(array($this->__phpunit_originalObject, "bar"), $__phpunit_arguments);
|
||||
}
|
||||
|
||||
@@ -35,11 +35,15 @@ print $code;
|
||||
}
|
||||
}
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke(
|
||||
new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'bar', $__phpunit_arguments, 'void', $this, false
|
||||
)
|
||||
$__phpunit_invocation = new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
|
||||
'Foo', 'bar', $__phpunit_arguments, 'void', $this, false
|
||||
);
|
||||
|
||||
$__phpunit_invocation->setProxiedCall();
|
||||
|
||||
$this->__phpunit_getInvocationMocker()->invoke($__phpunit_invocation);
|
||||
|
||||
unset($__phpunit_invocation);
|
||||
|
||||
call_user_func_array(array($this->__phpunit_originalObject, "bar"), $__phpunit_arguments);
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
.phpunit.result.cache
|
||||
|
||||
@@ -4,12 +4,11 @@ phpunit --random-order --random-order-seed=54321 --resolve-dependencies ../_file
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--debug';
|
||||
$_SERVER['argv'][3] = '--verbose';
|
||||
$_SERVER['argv'][4] = '--random-order';
|
||||
$_SERVER['argv'][5] = '--random-order-seed=54321';
|
||||
$_SERVER['argv'][6] = '--resolve-dependencies';
|
||||
$_SERVER['argv'][7] = 'MultiDependencyTest';
|
||||
$_SERVER['argv'][8] = __DIR__ . '/../_files/MultiDependencyTest.php';
|
||||
$_SERVER['argv'][3] = '--random-order';
|
||||
$_SERVER['argv'][4] = '--random-order-seed=54321';
|
||||
$_SERVER['argv'][5] = '--resolve-dependencies';
|
||||
$_SERVER['argv'][6] = 'MultiDependencyTest';
|
||||
$_SERVER['argv'][7] = __DIR__ . '/../_files/MultiDependencyTest.php';
|
||||
|
||||
require __DIR__ . '/../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
@@ -17,7 +16,6 @@ PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
Runtime: %s
|
||||
Random seed: 54321
|
||||
|
||||
Test 'MultiDependencyTest::testTwo' started
|
||||
|
||||
@@ -966,6 +966,30 @@ XML;
|
||||
$this->assertObjectHasAttribute('foo', $o);
|
||||
}
|
||||
|
||||
public function testAssertObjectHasAttributeNumericAttribute(): void
|
||||
{
|
||||
$object = new \stdClass;
|
||||
$object->{'2020'} = 'Tokyo';
|
||||
|
||||
$this->assertObjectHasAttribute('2020', $object);
|
||||
|
||||
$this->expectException(AssertionFailedError::class);
|
||||
|
||||
$this->assertObjectHasAttribute('2018', $object);
|
||||
}
|
||||
|
||||
public function testAssertObjectHasAttributeMultiByteAttribute(): void
|
||||
{
|
||||
$object = new \stdClass;
|
||||
$object->{'東京'} = 2020;
|
||||
|
||||
$this->assertObjectHasAttribute('東京', $object);
|
||||
|
||||
$this->expectException(AssertionFailedError::class);
|
||||
|
||||
$this->assertObjectHasAttribute('長野', $object);
|
||||
}
|
||||
|
||||
public function testAssertObjectNotHasAttribute(): void
|
||||
{
|
||||
$o = new \Author('Terry Pratchett');
|
||||
@@ -977,6 +1001,30 @@ XML;
|
||||
$this->assertObjectNotHasAttribute('name', $o);
|
||||
}
|
||||
|
||||
public function testAssertObjectNotHasAttributeNumericAttribute(): void
|
||||
{
|
||||
$object = new \stdClass;
|
||||
$object->{'2020'} = 'Tokyo';
|
||||
|
||||
$this->assertObjectNotHasAttribute('2018', $object);
|
||||
|
||||
$this->expectException(AssertionFailedError::class);
|
||||
|
||||
$this->assertObjectNotHasAttribute('2020', $object);
|
||||
}
|
||||
|
||||
public function testAssertObjectNotHasAttributeMultiByteAttribute(): void
|
||||
{
|
||||
$object = new \stdClass;
|
||||
$object->{'東京'} = 2020;
|
||||
|
||||
$this->assertObjectNotHasAttribute('長野', $object);
|
||||
|
||||
$this->expectException(AssertionFailedError::class);
|
||||
|
||||
$this->assertObjectNotHasAttribute('東京', $object);
|
||||
}
|
||||
|
||||
public function testAssertFinite(): void
|
||||
{
|
||||
$this->assertFinite(1);
|
||||
@@ -3004,6 +3052,38 @@ XML;
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testIterableContainsSameObjectCanBeAsserted(): void
|
||||
{
|
||||
$object = new \stdClass;
|
||||
$iterable = [$object];
|
||||
|
||||
$this->assertContains($object, $iterable);
|
||||
|
||||
try {
|
||||
$this->assertContains(new \stdClass, $iterable);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testIterableNotContainsSameObjectCanBeAsserted(): void
|
||||
{
|
||||
$object = new \stdClass;
|
||||
$iterable = [$object];
|
||||
|
||||
$this->assertNotContains(new \stdClass, $iterable);
|
||||
|
||||
try {
|
||||
$this->assertNotContains($object, $iterable);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
protected function sameValues(): array
|
||||
{
|
||||
$object = new \SampleClass(4, 8, 15);
|
||||
|
||||
@@ -36,7 +36,7 @@ abstract class ConstraintTestCase extends TestCase
|
||||
$this->assertTrue($reflection->implementsInterface(SelfDescribing::class), \sprintf(
|
||||
'Failed to assert that "%s" implements "%s".',
|
||||
$className,
|
||||
\Countable::class
|
||||
SelfDescribing::class
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,43 +13,41 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ExceptionMessageRegExpTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessageRegExp /^A polymorphic \w+ message/
|
||||
*/
|
||||
public function testRegexMessage(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessageRegExp('/^A polymorphic \w+ message/');
|
||||
|
||||
throw new \Exception('A polymorphic exception message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessageRegExp /^a poly[a-z]+ [a-zA-Z0-9_]+ me(s){2}age$/i
|
||||
*/
|
||||
public function testRegexMessageExtreme(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessageRegExp('/^a poly[a-z]+ [a-zA-Z0-9_]+ me(s){2}age$/i');
|
||||
|
||||
throw new \Exception('A polymorphic exception message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @requires extension xdebug
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessageRegExp #Screaming preg_match#
|
||||
*/
|
||||
public function testMessageXdebugScreamCompatibility(): void
|
||||
{
|
||||
\ini_set('xdebug.scream', '1');
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessageRegExp('#Screaming preg_match#');
|
||||
|
||||
throw new \Exception('Screaming preg_match');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception variadic
|
||||
* @expectedExceptionMessageRegExp /^A variadic \w+ message/
|
||||
*/
|
||||
public function testSimultaneousLiteralAndRegExpExceptionMessage(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessageRegExp('/^A variadic \w+ message/');
|
||||
|
||||
throw new \Exception('A variadic exception message');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,39 +13,35 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ExceptionMessageTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage A literal exception message
|
||||
*/
|
||||
public function testLiteralMessage(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('A literal exception message');
|
||||
|
||||
throw new \Exception('A literal exception message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage A partial
|
||||
*/
|
||||
public function testPartialMessageBegin(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('A partial');
|
||||
|
||||
throw new \Exception('A partial exception message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage partial exception
|
||||
*/
|
||||
public function testPartialMessageMiddle(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('partial exception');
|
||||
|
||||
throw new \Exception('A partial exception message');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
* @expectedExceptionMessage exception message
|
||||
*/
|
||||
public function testPartialMessageEnd(): void
|
||||
{
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('exception message');
|
||||
|
||||
throw new \Exception('A partial exception message');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,15 +17,31 @@ class StringEndsWithTest extends ConstraintTestCase
|
||||
public function testConstraintStringEndsWithCorrectValueAndReturnResult(): void
|
||||
{
|
||||
$constraint = new StringEndsWith('suffix');
|
||||
|
||||
$this->assertTrue($constraint->evaluate('foosuffix', '', true));
|
||||
}
|
||||
|
||||
public function testConstraintStringEndsWithNotCorrectValueAndReturnResult(): void
|
||||
{
|
||||
$constraint = new StringEndsWith('suffix');
|
||||
|
||||
$this->assertFalse($constraint->evaluate('suffixerror', '', true));
|
||||
}
|
||||
|
||||
public function testConstraintStringEndsWithCorrectNumericValueAndReturnResult(): void
|
||||
{
|
||||
$constraint = new StringEndsWith('0E1');
|
||||
|
||||
$this->assertTrue($constraint->evaluate('zzz0E1', '', true));
|
||||
}
|
||||
|
||||
public function testConstraintStringEndsWithNotCorrectNumericValueAndReturnResult(): void
|
||||
{
|
||||
$constraint = new StringEndsWith('0E1');
|
||||
|
||||
$this->assertFalse($constraint->evaluate('zzz0E2', '', true));
|
||||
}
|
||||
|
||||
public function testConstraintStringEndsWithToStringMethod(): void
|
||||
{
|
||||
$constraint = new StringEndsWith('suffix');
|
||||
|
||||
@@ -28,6 +28,20 @@ class StringStartsWithTest extends ConstraintTestCase
|
||||
$this->assertFalse($constraint->evaluate('error', '', true));
|
||||
}
|
||||
|
||||
public function testConstraintStringStartsWithCorrectNumericValueAndReturnResult(): void
|
||||
{
|
||||
$constraint = new StringStartsWith('0E1');
|
||||
|
||||
$this->assertTrue($constraint->evaluate('0E1zzz', '', true));
|
||||
}
|
||||
|
||||
public function testConstraintStringStartsWithNotCorrectNumericValueAndReturnResult(): void
|
||||
{
|
||||
$constraint = new StringStartsWith('0E1');
|
||||
|
||||
$this->assertFalse($constraint->evaluate('0E2zzz', '', true));
|
||||
}
|
||||
|
||||
public function testConstraintStringStartsWithToStringMethod(): void
|
||||
{
|
||||
$constraint = new StringStartsWith('prefix');
|
||||
@@ -73,7 +87,8 @@ EOF
|
||||
} catch (ExpectationFailedException $e) {
|
||||
$this->assertEquals(
|
||||
<<<EOF
|
||||
custom message\nFailed asserting that 'error' starts with "prefix".
|
||||
custom message
|
||||
Failed asserting that 'error' starts with "prefix".
|
||||
|
||||
EOF
|
||||
,
|
||||
|
||||
@@ -202,7 +202,7 @@ class GeneratorTest extends TestCase
|
||||
$this->assertNull($mock->someMethod());
|
||||
}
|
||||
|
||||
public function testMockingOfThrowable(): void
|
||||
public function testMockingOfExceptionWithThrowable(): void
|
||||
{
|
||||
$stub = $this->generator->getMock(ExceptionWithThrowable::class);
|
||||
|
||||
@@ -211,6 +211,15 @@ class GeneratorTest extends TestCase
|
||||
$this->assertInstanceOf(MockObject::class, $stub);
|
||||
}
|
||||
|
||||
public function testMockingOfThrowable(): void
|
||||
{
|
||||
$stub = $this->generator->getMock(Throwable::class);
|
||||
|
||||
$this->assertInstanceOf(Throwable::class, $stub);
|
||||
$this->assertInstanceOf(Exception::class, $stub);
|
||||
$this->assertInstanceOf(MockObject::class, $stub);
|
||||
}
|
||||
|
||||
public function testVariadicArgumentsArePassedToOriginalMethod()
|
||||
{
|
||||
/** @var ClassWithVariadicArgumentMethod|MockObject $mock */
|
||||
|
||||
@@ -272,7 +272,7 @@ class MockObjectTest extends TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('doSomething')
|
||||
->will($this->returnCallback('functionCallback'));
|
||||
->will($this->returnCallback('FunctionCallbackWrapper::functionCallback'));
|
||||
|
||||
$this->assertEquals('pass', $mock->doSomething('foo', 'bar'));
|
||||
|
||||
@@ -282,7 +282,7 @@ class MockObjectTest extends TestCase
|
||||
|
||||
$mock->expects($this->once())
|
||||
->method('doSomething')
|
||||
->willReturnCallback('functionCallback');
|
||||
->willReturnCallback('FunctionCallbackWrapper::functionCallback');
|
||||
|
||||
$this->assertEquals('pass', $mock->doSomething('foo', 'bar'));
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php declare(strict_types=1);
|
||||
/*
|
||||
* This file is part of PHPUnit.
|
||||
*
|
||||
@@ -8,34 +8,86 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ProxyObjectTest extends TestCase
|
||||
final class ProxyObjectTest extends TestCase
|
||||
{
|
||||
public function testMockedMethodIsProxiedToOriginalMethod(): void
|
||||
public function testProxyingWorksForMethodThatReturnsUndeclaredScalarValue(): void
|
||||
{
|
||||
$proxy = $this->getMockBuilder(Bar::class)
|
||||
->enableProxyingToOriginalMethods()
|
||||
->getMock();
|
||||
$proxy = $this->createTestProxy(TestProxyFixture::class);
|
||||
|
||||
$proxy->expects($this->once())
|
||||
->method('doSomethingElse');
|
||||
->method('returnString');
|
||||
|
||||
$foo = new Foo;
|
||||
\assert($proxy instanceof MockObject);
|
||||
\assert($proxy instanceof TestProxyFixture);
|
||||
|
||||
$this->assertEquals('result', $foo->doSomething($proxy));
|
||||
$this->assertSame('result', $proxy->returnString());
|
||||
}
|
||||
|
||||
public function testMockedMethodWithReferenceIsProxiedToOriginalMethod(): void
|
||||
public function testProxyingWorksForMethodThatReturnsDeclaredScalarValue(): void
|
||||
{
|
||||
$proxy = $this->getMockBuilder(MethodCallbackByReference::class)
|
||||
->enableProxyingToOriginalMethods()
|
||||
->getMock();
|
||||
$proxy = $this->createTestProxy(TestProxyFixture::class);
|
||||
|
||||
$a = $b = $c = 0;
|
||||
$proxy->expects($this->once())
|
||||
->method('returnTypedString');
|
||||
|
||||
$proxy->callback($a, $b, $c);
|
||||
\assert($proxy instanceof MockObject);
|
||||
\assert($proxy instanceof TestProxyFixture);
|
||||
|
||||
$this->assertEquals(1, $b);
|
||||
$this->assertSame('result', $proxy->returnTypedString());
|
||||
}
|
||||
|
||||
public function testProxyingWorksForMethodThatReturnsUndeclaredObject(): void
|
||||
{
|
||||
$proxy = $this->createTestProxy(TestProxyFixture::class);
|
||||
|
||||
$proxy->expects($this->once())
|
||||
->method('returnObject');
|
||||
|
||||
\assert($proxy instanceof MockObject);
|
||||
\assert($proxy instanceof TestProxyFixture);
|
||||
|
||||
$this->assertSame('bar', $proxy->returnObject()->foo);
|
||||
}
|
||||
|
||||
public function testProxyingWorksForMethodThatReturnsDeclaredObject(): void
|
||||
{
|
||||
$proxy = $this->createTestProxy(TestProxyFixture::class);
|
||||
|
||||
$proxy->expects($this->once())
|
||||
->method('returnTypedObject');
|
||||
|
||||
\assert($proxy instanceof MockObject);
|
||||
\assert($proxy instanceof TestProxyFixture);
|
||||
|
||||
$this->assertSame('bar', $proxy->returnTypedObject()->foo);
|
||||
}
|
||||
|
||||
public function testProxyingWorksForMethodThatReturnsUndeclaredObjectOfFinalClass(): void
|
||||
{
|
||||
$proxy = $this->createTestProxy(TestProxyFixture::class);
|
||||
|
||||
$proxy->expects($this->once())
|
||||
->method('returnObjectOfFinalClass');
|
||||
|
||||
\assert($proxy instanceof MockObject);
|
||||
\assert($proxy instanceof TestProxyFixture);
|
||||
|
||||
$this->assertSame('value', $proxy->returnObjectOfFinalClass()->value());
|
||||
}
|
||||
|
||||
public function testProxyingWorksForMethodThatReturnsDeclaredObjectOfFinalClass(): void
|
||||
{
|
||||
$proxy = $this->createTestProxy(TestProxyFixture::class);
|
||||
|
||||
$proxy->expects($this->once())
|
||||
->method('returnTypedObjectOfFinalClass');
|
||||
|
||||
\assert($proxy instanceof MockObject);
|
||||
\assert($proxy instanceof TestProxyFixture);
|
||||
|
||||
$this->assertSame('value', $proxy->returnTypedObjectOfFinalClass()->value());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ use PHPUnit\Runner\BaseTestRunner;
|
||||
|
||||
class TestCaseTest extends TestCase
|
||||
{
|
||||
protected static $testStatic = 0;
|
||||
protected static $testStatic = 456;
|
||||
|
||||
protected $backupGlobalsBlacklist = ['i', 'singleton'];
|
||||
|
||||
@@ -175,6 +175,7 @@ class TestCaseTest extends TestCase
|
||||
$this->assertTrue($test->assertPostConditions);
|
||||
$this->assertTrue($test->tearDown);
|
||||
$this->assertEquals(BaseTestRunner::STATUS_ERROR, $test->getStatus());
|
||||
$this->assertSame('throw Exception in tearDown()', $test->getStatusMessage());
|
||||
}
|
||||
|
||||
public function testExceptionInTestIsDetectedInTeardown(): void
|
||||
@@ -418,6 +419,9 @@ class TestCaseTest extends TestCase
|
||||
public function testStaticAttributesBackupPre(): void
|
||||
{
|
||||
$GLOBALS['singleton'] = \Singleton::getInstance();
|
||||
$GLOBALS['i'] = 'not reset by backup';
|
||||
|
||||
$GLOBALS['j'] = 'reset by backup';
|
||||
self::$testStatic = 123;
|
||||
}
|
||||
|
||||
@@ -426,8 +430,15 @@ class TestCaseTest extends TestCase
|
||||
*/
|
||||
public function testStaticAttributesBackupPost(): void
|
||||
{
|
||||
$this->assertNotSame($GLOBALS['singleton'], \Singleton::getInstance());
|
||||
$this->assertSame(0, self::$testStatic);
|
||||
// Snapshots made by @backupGlobals
|
||||
$this->assertSame(\Singleton::getInstance(), $GLOBALS['singleton']);
|
||||
$this->assertSame('not reset by backup', $GLOBALS['i']);
|
||||
|
||||
// Reset global
|
||||
$this->assertArrayNotHasKey('j', $GLOBALS);
|
||||
|
||||
// Static reset to original state by @backupStaticAttributes
|
||||
$this->assertSame(456, self::$testStatic);
|
||||
}
|
||||
|
||||
public function testIsInIsolationReturnsFalse(): void
|
||||
@@ -577,10 +588,10 @@ class TestCaseTest extends TestCase
|
||||
'PHPUnit >= 9-dev is required.' . \PHP_EOL .
|
||||
'Operating system matching /DOESNOTEXIST/i is required.' . \PHP_EOL .
|
||||
'Function testFuncOne is required.' . \PHP_EOL .
|
||||
'Function testFuncTwo is required.' . \PHP_EOL .
|
||||
'Function testFunc2 is required.' . \PHP_EOL .
|
||||
'Setting "not_a_setting" must be "Off".' . \PHP_EOL .
|
||||
'Extension testExtOne is required.' . \PHP_EOL .
|
||||
'Extension testExtTwo is required.' . \PHP_EOL .
|
||||
'Extension testExt2 is required.' . \PHP_EOL .
|
||||
'Extension testExtThree >= 2.0 is required.',
|
||||
$test->getStatusMessage()
|
||||
);
|
||||
@@ -644,11 +655,13 @@ class TestCaseTest extends TestCase
|
||||
|
||||
/**
|
||||
* @requires PHP 7
|
||||
* @expectedException \TypeError
|
||||
*/
|
||||
public function testTypeErrorCanBeExpected(): void
|
||||
{
|
||||
$o = new \ClassWithScalarTypeDeclarations;
|
||||
|
||||
$this->expectException(\TypeError::class);
|
||||
|
||||
$o->foo(null, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,18 @@ class TestSuiteTest extends TestCase
|
||||
$this->result = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox TestSuite can be created with name of existing non-TestCase class
|
||||
*/
|
||||
public function testSuiteNameCanBeSameAsExistingNonTestClassName(): void
|
||||
{
|
||||
$suite = new TestSuite('stdClass');
|
||||
$suite->addTestSuite(\OneTestCase::class);
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertCount(1, $this->result);
|
||||
}
|
||||
|
||||
public function testAddTestSuite(): void
|
||||
{
|
||||
$suite = new TestSuite(\OneTestCase::class);
|
||||
@@ -57,13 +69,6 @@ class TestSuiteTest extends TestCase
|
||||
$this->assertCount(1, $this->result);
|
||||
}
|
||||
|
||||
public function testNoTestCaseClass(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
|
||||
new TestSuite(\NoTestCaseClass::class);
|
||||
}
|
||||
|
||||
public function testNotPublicTestCase(): void
|
||||
{
|
||||
$suite = new TestSuite(\NotPublicTestCase::class);
|
||||
@@ -201,10 +206,6 @@ class TestSuiteTest extends TestCase
|
||||
$this->assertCount(2, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException PHPUnit\Framework\Exception
|
||||
* @expectedExceptionMessage No valid test provided.
|
||||
*/
|
||||
public function testCreateTestForConstructorlessTestClass(): void
|
||||
{
|
||||
$reflection = $this->getMockBuilder(\ReflectionClass::class)
|
||||
@@ -220,6 +221,30 @@ class TestSuiteTest extends TestCase
|
||||
$reflection->expects($this->once())
|
||||
->method('getName')
|
||||
->willReturn(__CLASS__);
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('No valid test provided.');
|
||||
|
||||
TestSuite::createTest($reflection, 'TestForConstructorlessTestClass');
|
||||
}
|
||||
|
||||
/**
|
||||
* @testdox Handles exceptions in tearDownAfterClass()
|
||||
*/
|
||||
public function testTearDownAfterClassInTestSuite(): void
|
||||
{
|
||||
$suite = new TestSuite(\ExceptionInTearDownAfterClassTest::class);
|
||||
$suite->run($this->result);
|
||||
|
||||
$this->assertSame(3, $this->result->count());
|
||||
$this->assertCount(1, $this->result->failures());
|
||||
|
||||
$failure = $this->result->failures()[0];
|
||||
|
||||
$this->assertSame(
|
||||
'Exception in ExceptionInTearDownAfterClassTest::tearDownAfterClass' . \PHP_EOL .
|
||||
'throw Exception in tearDownAfterClass()',
|
||||
$failure->thrownException()->getMessage()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,39 +208,38 @@ EOF
|
||||
$this->testCase->run();
|
||||
}
|
||||
|
||||
public function testShouldThrowsAnExceptionWhenPhptFileIsEmpty(): void
|
||||
public function testShouldSkipTestWhenPhptFileIsEmpty(): void
|
||||
{
|
||||
$this->setPhpContent('');
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('Invalid PHPT file');
|
||||
|
||||
$this->testCase->run();
|
||||
$result = $this->testCase->run();
|
||||
$this->assertCount(1, $result->skipped());
|
||||
$this->assertSame('Invalid PHPT file', $result->skipped()[0]->thrownException()->getMessage());
|
||||
}
|
||||
|
||||
public function testShouldThrowsAnExceptionWhenFileSectionIsMissing(): void
|
||||
public function testShouldSkipTestWhenFileSectionIsMissing(): void
|
||||
{
|
||||
$this->setPhpContent(
|
||||
<<<EOF
|
||||
--TEST--
|
||||
Something to decribe it
|
||||
Something to describe it
|
||||
--EXPECT--
|
||||
Something
|
||||
EOF
|
||||
);
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('Invalid PHPT file');
|
||||
$result = $this->testCase->run();
|
||||
|
||||
$this->testCase->run();
|
||||
$this->assertCount(1, $result->skipped());
|
||||
$this->assertSame('Invalid PHPT file', $result->skipped()[0]->thrownException()->getMessage());
|
||||
}
|
||||
|
||||
public function testShouldThrowsAnExceptionWhenThereIsNoExpecOrExpectifOrExpecregexSectionInPhptFile(): void
|
||||
public function testShouldSkipTestWhenThereIsNoExpecOrExpectifOrExpecregexSectionInPhptFile(): void
|
||||
{
|
||||
$this->setPhpContent(
|
||||
<<<EOF
|
||||
--TEST--
|
||||
Something to decribe it
|
||||
Something to describe it
|
||||
--FILE--
|
||||
<?php
|
||||
echo "Hello world!\n";
|
||||
@@ -248,10 +247,30 @@ echo "Hello world!\n";
|
||||
EOF
|
||||
);
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('Invalid PHPT file');
|
||||
$result = $this->testCase->run();
|
||||
|
||||
$this->testCase->run();
|
||||
$this->assertCount(1, $result->skipped());
|
||||
$skipMessage = $result->skipped()[0]->thrownException()->getMessage();
|
||||
$this->assertSame('Invalid PHPT file', $skipMessage);
|
||||
}
|
||||
|
||||
public function testShouldSkipTestWhenSectionHeaderIsMalformed(): void
|
||||
{
|
||||
$this->setPhpContent(
|
||||
<<<EOF
|
||||
----
|
||||
--TEST--
|
||||
This is not going to work out
|
||||
--EXPECT--
|
||||
Tears and misery
|
||||
EOF
|
||||
);
|
||||
|
||||
$result = $this->testCase->run();
|
||||
|
||||
$this->assertCount(1, $result->skipped());
|
||||
$skipMessage = $result->skipped()[0]->thrownException()->getMessage();
|
||||
$this->assertSame('Invalid PHPT file: empty section header', $skipMessage);
|
||||
}
|
||||
|
||||
public function testShouldValidateExpectSession(): void
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
namespace PHPUnit\Util;
|
||||
|
||||
use PHPUnit\Framework\Exception;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class JsonTest extends TestCase
|
||||
@@ -60,11 +61,12 @@ class JsonTest extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider prettifyExceptionProvider
|
||||
* @expectedException \PHPUnit\Framework\Exception
|
||||
* @expectedExceptionMessage Cannot prettify invalid json
|
||||
*/
|
||||
public function testPrettifyException($json): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('Cannot prettify invalid json');
|
||||
|
||||
Json::prettify($json);
|
||||
}
|
||||
|
||||
|
||||
@@ -157,14 +157,14 @@ class TestTest extends TestCase
|
||||
'OS' => 'DOESNOTEXIST',
|
||||
'functions' => [
|
||||
'testFuncOne',
|
||||
'testFuncTwo',
|
||||
'testFunc2',
|
||||
],
|
||||
'setting' => [
|
||||
'not_a_setting' => 'Off',
|
||||
],
|
||||
'extensions' => [
|
||||
'testExtOne',
|
||||
'testExtTwo',
|
||||
'testExt2',
|
||||
'testExtThree',
|
||||
],
|
||||
'extension_versions' => [
|
||||
@@ -526,10 +526,10 @@ class TestTest extends TestCase
|
||||
'PHPUnit >= 9-dev is required.',
|
||||
'Operating system matching /DOESNOTEXIST/i is required.',
|
||||
'Function testFuncOne is required.',
|
||||
'Function testFuncTwo is required.',
|
||||
'Function testFunc2 is required.',
|
||||
'Setting "not_a_setting" must be "Off".',
|
||||
'Extension testExtOne is required.',
|
||||
'Extension testExtTwo is required.',
|
||||
'Extension testExt2 is required.',
|
||||
'Extension testExtThree >= 2.0 is required.',
|
||||
]],
|
||||
['testPHPVersionOperatorLessThan', ['PHP < 5.4 is required.']],
|
||||
|
||||
@@ -18,11 +18,50 @@ class XDebugFilterScriptGeneratorTest extends TestCase
|
||||
*/
|
||||
public function testReturnsExpectedScript(): void
|
||||
{
|
||||
$expectedDirectory = \sprintf('%s/', __DIR__);
|
||||
$expected = <<<EOF
|
||||
<?php declare(strict_types=1);
|
||||
if (!\\function_exists('xdebug_set_filter')) {
|
||||
return;
|
||||
}
|
||||
|
||||
\\xdebug_set_filter(
|
||||
\\XDEBUG_FILTER_CODE_COVERAGE,
|
||||
\\XDEBUG_PATH_WHITELIST,
|
||||
[
|
||||
'$expectedDirectory',
|
||||
'$expectedDirectory',
|
||||
'$expectedDirectory',
|
||||
'src/foo.php',
|
||||
'src/bar.php'
|
||||
]
|
||||
);
|
||||
|
||||
EOF;
|
||||
|
||||
$directoryPathThatDoesNotExist = \sprintf('%s/path/that/does/not/exist', __DIR__);
|
||||
$this->assertDirectoryNotExists($directoryPathThatDoesNotExist);
|
||||
|
||||
$filterConfiguration = [
|
||||
'include' => [
|
||||
'directory' => [
|
||||
[
|
||||
'path' => 'src/somePath',
|
||||
'path' => __DIR__,
|
||||
'suffix' => '.php',
|
||||
'prefix' => '',
|
||||
],
|
||||
[
|
||||
'path' => \sprintf('%s/', __DIR__),
|
||||
'suffix' => '.php',
|
||||
'prefix' => '',
|
||||
],
|
||||
[
|
||||
'path' => \sprintf('%s/./%s', \dirname(__DIR__), \basename(__DIR__)),
|
||||
'suffix' => '.php',
|
||||
'prefix' => '',
|
||||
],
|
||||
[
|
||||
'path' => $directoryPathThatDoesNotExist,
|
||||
'suffix' => '.php',
|
||||
'prefix' => '',
|
||||
],
|
||||
@@ -41,6 +80,6 @@ class XDebugFilterScriptGeneratorTest extends TestCase
|
||||
$writer = new XdebugFilterScriptGenerator;
|
||||
$actual = $writer->generate($filterConfiguration);
|
||||
|
||||
$this->assertStringEqualsFile(__DIR__ . '/_files/expectedXDebugFilterScript.txt', $actual);
|
||||
$this->assertSame($expected, $actual);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
if (!\function_exists('xdebug_set_filter')) {
|
||||
return;
|
||||
}
|
||||
|
||||
\xdebug_set_filter(
|
||||
\XDEBUG_FILTER_CODE_COVERAGE,
|
||||
\XDEBUG_PATH_WHITELIST,
|
||||
[
|
||||
'src/somePath',
|
||||
'src/foo.php',
|
||||
'src/bar.php'
|
||||
]
|
||||
);
|
||||
Reference in New Issue
Block a user