upgrade to laravel 7 and set branch to v2

This commit is contained in:
2020-12-25 11:22:15 +00:00
parent 516105c492
commit 0ddd298350
4638 changed files with 132501 additions and 190226 deletions
-14
View File
@@ -1,14 +0,0 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
charset = utf-8
[*.yml]
indent_size = 2
[tests/_files/*_result_cache.txt]
insert_final_newline = false
-7
View File
@@ -1,7 +0,0 @@
/.docker export-ignore
/build export-ignore
/tools export-ignore
/tools/* binary
*.php diff=php
-28
View File
@@ -1,28 +0,0 @@
# Contributor Code of Conduct
As contributors and maintainers of this project, and in the interest of fostering an open and welcoming community, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion, or nationality.
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery
* Personal attacks
* Trolling or insulting/derogatory comments
* Public or private harassment
* Publishing other's private information, such as physical or electronic
addresses, without explicit permission
* Other unethical or unprofessional conduct
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
By adopting this Code of Conduct, project maintainers commit themselves to fairly and consistently applying these principles to every aspect of managing this project. Project maintainers who do not follow or enforce the Code of Conduct may be permanently removed from the project team.
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer at sebastian@phpunit.de. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. Maintainers are obligated to maintain confidentiality with regard to the reporter of an incident.
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.3.0, available at [https://contributor-covenant.org/version/1/3/0/][version]
[homepage]: https://contributor-covenant.org
[version]: https://contributor-covenant.org/version/1/3/0/
-68
View File
@@ -1,68 +0,0 @@
# Contributing to PHPUnit
## Contributor Code of Conduct
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
## Workflow
* Fork the project.
* Make your bug fix or feature addition.
* Add tests for it. This is important so we don't break it in a future version unintentionally.
* Send a pull request. Bonus points for topic branches.
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 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.
Due to time constraints, we are not always able to respond as quickly as we would like. Please do not take delays personal and feel free to remind us if you feel that we forgot to respond.
## Coding Guidelines
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
$ ./tools/php-cs-fixer fix
```
## Using PHPUnit from a Git checkout
The following commands can be used to perform the initial checkout of PHPUnit:
```bash
$ git clone git://github.com/sebastianbergmann/phpunit.git
$ cd phpunit
```
Retrieve PHPUnit's dependencies using [Composer](https://getcomposer.org/):
```bash
$ ./tools/composer install
```
The `phpunit` script can be used to invoke the PHPUnit test runner:
```bash
$ ./phpunit --version
```
## Running PHPUnit's own test suite
After following the steps shown above, PHPUnit's own test suite is run like this:
```bash
$ ./phpunit
```
## Reporting issues
Please use the most specific issue tracker to search for existing tickets and to open new tickets:
* [General problems](https://github.com/sebastianbergmann/phpunit/issues)
* [Code Coverage](https://github.com/sebastianbergmann/php-code-coverage/issues)
* [Documentation](https://github.com/sebastianbergmann/phpunit-documentation-english/issues)
* [Website](https://github.com/sebastianbergmann/phpunit-website/issues)
-15
View File
@@ -1,15 +0,0 @@
| Q | A
| --------------------| ---------------
| PHPUnit version | x.y.z
| PHP version | x.y.z
| Installation Method | Composer / PHAR
<!--
- Please fill in this template according to your issue.
- Please keep the table shown above at the top of your issue.
- Please include the output of "composer info | sort" if you installed PHPUnit using Composer.
- Please post code as text (using proper markup). Do not post screenshots of code.
- Visit https://phpunit.de/support.html if you are looking for support.
- Otherwise, replace this comment by the description of your issue.
-->
-84
View File
@@ -1,84 +0,0 @@
# https://help.github.com/en/categories/automating-your-workflow-with-github-actions
on:
- pull_request
- push
name: CI
jobs:
coding-guidelines:
name: Coding Guidelines
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Run friendsofphp/php-cs-fixer
run: php7.3 ./tools/php-cs-fixer fix --diff-format=udiff --dry-run --show-progress=dots --using-cache=no --verbose
lint-xml-configuration:
name: Lint XML Configuration
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build Docker image
uses: ./.docker/lint-xml-configuration
- name: Lint XML configuration files
uses: ./.docker/lint-xml-configuration
with:
args: bash ./build/lint-xml-configuration
tests:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
php-binary:
- php7.1
- php7.2
- php7.3
dependencies:
- lowest
- highest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: "Cache dependencies installed with composer"
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: ${{ matrix.php-binary }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ matrix.php-binary }}-composer-${{ matrix.dependencies }}-
- name: Install lowest dependencies with composer
if: matrix.dependencies == 'lowest'
run: ${{ matrix.php-binary }} ./tools/composer update --no-ansi --no-interaction --no-progress --no-suggest --prefer-lowest
- name: Install highest dependencies with composer
if: matrix.dependencies == 'highest'
run: ${{ matrix.php-binary }} ./tools/composer update --no-ansi --no-interaction --no-progress --no-suggest
- name: Run sanity check
run: PHP_BINARY=${{ matrix.php-binary }} bash ./build/sanity-check
- name: Run tests with phpunit
run: ${{ matrix.php-binary }} -d assert.exception=1 -d zend.assertions=1 ./phpunit --coverage-clover=coverage.xml
- name: Send code coverage report to Codecov.io
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: bash <(curl -s https://codecov.io/bash) || true
-21
View File
@@ -1,21 +0,0 @@
/.ant_targets
/.idea
/.php_cs
/.php_cs.cache
/build/documentation
/build/logfiles
/build/phar
/build/phpdox
/build/*.phar
/build/*.phar.asc
/build/binary-phar-autoload.php
/cache.properties
/composer.lock
/tests/end-to-end/*.diff
/tests/end-to-end/*.exp
/tests/end-to-end/*.log
/tests/end-to-end/*.out
/tests/end-to-end/*.php
/vendor
.phpunit.result.cache
.psalm
-201
View File
@@ -1,201 +0,0 @@
<?php
$header = <<<'EOF'
This file is part of PHPUnit.
(c) Sebastian Bergmann <sebastian@phpunit.de>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
EOF;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules(
[
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'binary_operator_spaces' => [
'operators' => [
'=' => 'align',
'=>' => 'align',
],
],
'blank_line_after_namespace' => true,
'blank_line_before_statement' => [
'statements' => [
'break',
'continue',
'declare',
'do',
'for',
'foreach',
'if',
'include',
'include_once',
'require',
'require_once',
'return',
'switch',
'throw',
'try',
'while',
'yield',
],
],
'braces' => true,
'cast_spaces' => true,
'class_attributes_separation' => ['elements' => ['const', 'method', 'property']],
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'dir_constant' => true,
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'function_declaration' => true,
'header_comment' => ['header' => $header, 'separate' => 'none'],
'indentation_type' => true,
'is_null' => true,
'line_ending' => true,
'list_syntax' => ['syntax' => 'short'],
'logical_operators' => true,
'lowercase_cast' => true,
'lowercase_constants' => true,
'lowercase_keywords' => true,
'lowercase_static_reference' => true,
'magic_constant_casing' => true,
'method_argument_space' => ['ensure_fully_multiline' => true],
'modernize_types_casting' => true,
'multiline_comment_opening_closing' => true,
'multiline_whitespace_before_semicolons' => true,
'native_constant_invocation' => true,
'native_function_casing' => true,
'native_function_invocation' => true,
'new_with_braces' => false,
'no_alias_functions' => true,
'no_alternative_syntax' => true,
'no_blank_lines_after_class_opening' => true,
'no_blank_lines_after_phpdoc' => true,
'no_blank_lines_before_namespace' => true,
'no_closing_tag' => true,
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_blank_lines' => true,
'no_homoglyph_names' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => ['use' => 'print'],
'no_multiline_whitespace_around_double_arrow' => true,
'no_null_property_initialization' => true,
'no_php4_constructor' => true,
'no_short_bool_cast' => true,
'no_short_echo_tag' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_after_function_name' => true,
'no_spaces_inside_parenthesis' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unneeded_final_method' => true,
'no_unreachable_default_argument_value' => true,
'no_unset_on_property' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'no_whitespace_before_comma_in_array' => true,
'no_whitespace_in_blank_line' => true,
'non_printable_character' => true,
'normalize_index_brace' => true,
'object_operator_without_whitespace' => true,
'ordered_class_elements' => [
'order' => [
'use_trait',
'constant_public',
'constant_protected',
'constant_private',
'property_public_static',
'property_protected_static',
'property_private_static',
'property_public',
'property_protected',
'property_private',
'method_public_static',
'construct',
'destruct',
'magic',
'phpunit',
'method_public',
'method_protected',
'method_private',
'method_protected_static',
'method_private_static',
],
],
'ordered_imports' => true,
'ordered_interfaces' => [
'direction' => 'ascend',
'order' => 'alpha',
],
'phpdoc_add_missing_param_annotation' => true,
'phpdoc_align' => true,
'phpdoc_annotation_without_dot' => true,
'phpdoc_indent' => true,
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
'phpdoc_separation' => true,
'phpdoc_single_line_var_spacing' => true,
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => ['groups' => ['simple', 'meta']],
'phpdoc_types_order' => true,
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => true,
'protected_to_private' => true,
'return_assignment' => true,
'return_type_declaration' => ['space_before' => 'none'],
'self_accessor' => true,
'semicolon_after_instruction' => true,
'set_type_to_cast' => true,
'short_scalar_cast' => true,
'simplified_null_return' => false,
'single_blank_line_at_eof' => true,
'single_import_per_statement' => true,
'single_line_after_imports' => true,
'single_quote' => true,
'standardize_not_equals' => true,
'ternary_to_null_coalescing' => true,
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'elements' => [
'const',
'method',
'property',
],
],
//'void_return' => true,
'whitespace_after_comma_in_array' => true,
]
)
->setFinder(
PhpCsFixer\Finder::create()
->files()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests')
->notName('*.phpt')
);
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace PHPSTORM_META {
override(
\PHPUnit\Framework\TestCase::createMock(0),
map([
'@&\PHPUnit\Framework\MockObject\MockObject',
])
);
override(
\PHPUnit\Framework\TestCase::createStub(0),
map([
'@&\PHPUnit\Framework\MockObject\Stub',
])
);
override(
\PHPUnit\Framework\TestCase::createConfiguredMock(0),
map([
'@&\PHPUnit\Framework\MockObject\MockObject',
])
);
override(
\PHPUnit\Framework\TestCase::createPartialMock(0),
map([
'@&\PHPUnit\Framework\MockObject\MockObject',
])
);
override(
\PHPUnit\Framework\TestCase::createTestProxy(0),
map([
'@&\PHPUnit\Framework\MockObject\MockObject',
])
);
override(
\PHPUnit\Framework\TestCase::getMockForAbstractClass(0),
map([
'@&\PHPUnit\Framework\MockObject\MockObject',
])
);
}
-38
View File
@@ -1,38 +0,0 @@
language: php
jobs:
include:
- &COLLECT_CODE_COVERAGE
stage: Collect Code Coverage
php: 7.1
if: type = pull_request
before_install:
- ./tools/composer clear-cache
install:
- travis_retry ./tools/composer update --no-ansi --no-interaction --no-progress --no-suggest
before_script:
- echo 'zend.assertions=1' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- echo 'assert.exception=On' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
script:
- ./phpunit --coverage-clover=coverage.xml
after_success:
- bash <(curl -s https://codecov.io/bash)
- <<: *COLLECT_CODE_COVERAGE
php: 7.2
- <<: *COLLECT_CODE_COVERAGE
php: 7.3
notifications:
email: false
-195
View File
@@ -1,195 +0,0 @@
# Changes in PHPUnit 7.5
All notable changes of the PHPUnit 7.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [7.5.20] - 2020-01-08
### Removed
* `eval-stdin.php` has been removed, it was not used anymore since PHPUnit 7.2.7
## [7.5.19] - 2020-01-06
### Changed
* `eval-stdin.php` can now only be executed with `cli` and `phpdbg`
## [7.5.18] - 2019-12-06
### Fixed
* Fixed [#3967](https://github.com/sebastianbergmann/phpunit/issues/3967): Cannot double interface that extends interface that extends `\Throwable`
* Fixed [#3968](https://github.com/sebastianbergmann/phpunit/pull/3968): Test class run in a separate PHP process are passing when `exit` called inside
## [7.5.17] - 2019-10-28
### Fixed
* Fixed [#3727](https://github.com/sebastianbergmann/phpunit/issues/3727): Problem hidden by PHPUnit's error handler
* Fixed [#3863](https://github.com/sebastianbergmann/phpunit/pull/3863): `\Countable` needs to be checked before `\EmptyIterator`
## [7.5.16] - 2019-09-14
### Fixed
* Fixed [#3801](https://github.com/sebastianbergmann/phpunit/issues/3801): Class constant as default parameter is undefined
* Fixed [#3834](https://github.com/sebastianbergmann/phpunit/issues/3834): Trailing slash breaks code coverage on Windows
## [7.5.15] - 2019-08-21
### Changed
* Implemented [#3765](https://github.com/sebastianbergmann/phpunit/pull/3765): Use `ReflectionType::getName()` instead of `ReflectionType::__toString()` (which is deprecated in PHP 7.4)
## [7.5.14] - 2019-07-15
### Fixed
* Fixed [#3743](https://github.com/sebastianbergmann/phpunit/issues/3743): `EmptyIterator` instances are not handled correctly by `Count` and `IsEmpty` constraints
## [7.5.13] - 2019-06-19
### Fixed
* Fixed [#3722](https://github.com/sebastianbergmann/phpunit/issues/3722): `getObjectForTrait()` does not work for traits that declare a constructor
* Fixed [#3723](https://github.com/sebastianbergmann/phpunit/pull/3723): Unescaped dash in character group in regular expression
## [7.5.12] - 2019-05-28
### Changed
* After each test, `libxml_clear_errors()` is now called to clear the libxml error buffer
### Fixed
* Fixed [#3694](https://github.com/sebastianbergmann/phpunit/pull/3694): Constructor arguments for `Throwable` and `Exception` are ignored
* Fixed [#3709](https://github.com/sebastianbergmann/phpunit/pull/3709): Method-level `@coversNothing` annotation does not prevent code coverage data collection
## [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
* Fixed [#3441](https://github.com/sebastianbergmann/phpunit/issues/3441): Call to undefined method `DataProviderTestSuite::usesDataProvider()`
## [7.5.0] - 2018-12-07
### Added
* Implemented [#3340](https://github.com/sebastianbergmann/phpunit/issues/3340): Added `assertEqualsCanonicalizing()`, `assertEqualsIgnoringCase()`, `assertEqualsWithDelta()`, `assertNotEqualsCanonicalizing()`, `assertNotEqualsIgnoringCase()`, and `assertNotEqualsWithDelta()` as alternatives to using `assertEquals()` and `assertNotEquals()` with the `$delta`, `$canonicalize`, or `$ignoreCase` parameters
* Implemented [#3368](https://github.com/sebastianbergmann/phpunit/issues/3368): Added `assertIsArray()`, `assertIsBool()`, `assertIsFloat()`, `assertIsInt()`, `assertIsNumeric()`, `assertIsObject()`, `assertIsResource()`, `assertIsString()`, `assertIsScalar()`, `assertIsCallable()`, `assertIsIterable()`, `assertIsNotArray()`, `assertIsNotBool()`, `assertIsNotFloat()`, `assertIsNotInt()`, `assertIsNotNumeric()`, `assertIsNotObject()`, `assertIsNotResource()`, `assertIsNotString()`, `assertIsNotScalar()`, `assertIsNotCallable()`, `assertIsNotIterable()` as alternatives to `assertInternalType()` and `assertNotInternalType()`
* Implemented [#3391](https://github.com/sebastianbergmann/phpunit/issues/3391): Added a `TestHook` that fires after each test, regardless of result
* Implemented [#3417](https://github.com/sebastianbergmann/phpunit/pull/3417): Refinements related to test suite sorting and TestDox result printer
* Implemented [#3422](https://github.com/sebastianbergmann/phpunit/issues/3422): Added `assertStringContainsString()`, `assertStringContainsStringIgnoringCase()`, `assertStringNotContainsString()`, and `assertStringNotContainsStringIgnoringCase()`
### Deprecated
* The methods `assertInternalType()` and `assertNotInternalType()` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these methods will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these methods will be removed.
* The methods `assertAttributeContains()`, `assertAttributeNotContains()`, `assertAttributeContainsOnly()`, `assertAttributeNotContainsOnly()`, `assertAttributeCount()`, `assertAttributeNotCount()`, `assertAttributeEquals()`, `assertAttributeNotEquals()`, `assertAttributeEmpty()`, `assertAttributeNotEmpty()`, `assertAttributeGreaterThan()`, `assertAttributeGreaterThanOrEqual()`, `assertAttributeLessThan()`, `assertAttributeLessThanOrEqual()`, `assertAttributeSame()`, `assertAttributeNotSame()`, `assertAttributeInstanceOf()`, `assertAttributeNotInstanceOf()`, `assertAttributeInternalType()`, `assertAttributeNotInternalType()`, `attributeEqualTo()`, `readAttribute()`, `getStaticAttribute()`, and `getObjectAttribute()` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these methods will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these methods will be removed.
* The optional parameters `$delta`, `$maxDepth`, `$canonicalize`, and `$ignoreCase` of `assertEquals()` and `assertNotEquals()` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these parameters will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these parameters will be removed.
* The annotations `@expectedException`, `@expectedExceptionCode`, `@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these annotations will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these annotations will be removed.
* Using the methods `assertContains()` and `assertNotContains()` on `string` haystacks is now deprecated. There is no behavioral change in this version of PHPUnit. Using these methods on `string` haystacks will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these methods cannot be used on on `string` haystacks anymore.
* The optional parameters `$ignoreCase`, `$checkForObjectIdentity`, and `$checkForNonObjectIdentity` of `assertContains()` and `assertNotContains()` are now deprecated. There is no behavioral change in this version of PHPUnit. Using these parameters will trigger a deprecation warning in PHPUnit 8 and in PHPUnit 9 these parameters will be removed.
### Fixed
* Fixed [#3428](https://github.com/sebastianbergmann/phpunit/pull/3428): `TestSuite` setup failures are not logged correctly
* 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.20]: https://github.com/sebastianbergmann/phpunit/compare/7.5.19...7.5.20
[7.5.19]: https://github.com/sebastianbergmann/phpunit/compare/7.5.18...7.5.19
[7.5.18]: https://github.com/sebastianbergmann/phpunit/compare/7.5.17...7.5.18
[7.5.17]: https://github.com/sebastianbergmann/phpunit/compare/7.5.16...7.5.17
[7.5.16]: https://github.com/sebastianbergmann/phpunit/compare/7.5.15...7.5.16
[7.5.15]: https://github.com/sebastianbergmann/phpunit/compare/7.5.14...7.5.15
[7.5.14]: https://github.com/sebastianbergmann/phpunit/compare/7.5.13...7.5.14
[7.5.13]: https://github.com/sebastianbergmann/phpunit/compare/7.5.12...7.5.13
[7.5.12]: https://github.com/sebastianbergmann/phpunit/compare/7.5.11...7.5.12
[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
+132
View File
@@ -0,0 +1,132 @@
# Changes in PHPUnit 8.5
All notable changes of the PHPUnit 8.5 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
## [8.5.13] - 2020-12-01
### Fixed
* Running tests in isolated processes did not work with PHP 8 on Windows
## [8.5.12] - 2020-11-30
### Changed
* Changed PHP version constraint in `composer.json` from `^7.2` to `>=7.2` to allow the installation of PHPUnit 8.5 on PHP 8. Please note that the code coverage functionality is not available for PHPUnit 8.5 on PHP 8.
### Fixed
* [#4529](https://github.com/sebastianbergmann/phpunit/issues/4529): Debug mode of Xdebug 2 is not disabled for PHPT tests
## [8.5.11] - 2020-11-27
### Changed
* Bumped required version of `phpunit/php-code-coverage`
## [8.5.10] - 2020-11-27
### Added
* Support for Xdebug 3
### Fixed
* [#4516](https://github.com/sebastianbergmann/phpunit/issues/4516): `phpunit/phpunit-selenium` does not work with PHPUnit 8.5.9
## [8.5.9] - 2020-11-10
### Fixed
* [#3965](https://github.com/sebastianbergmann/phpunit/issues/3965): Process Isolation throws exceptions when PHPDBG is used
* [#4470](https://github.com/sebastianbergmann/phpunit/pull/4470): Infinite recursion when `--static-backup --strict-global-state` is used
## [8.5.8] - 2020-06-22
### Fixed
* [#4312](https://github.com/sebastianbergmann/phpunit/issues/4312): Fix for [#4299](https://github.com/sebastianbergmann/phpunit/issues/4299) breaks backward compatibility
## [8.5.7] - 2020-06-21
### Fixed
* [#4299](https://github.com/sebastianbergmann/phpunit/issues/4299): "No tests executed" does not always result in exit code `1`
* [#4306](https://github.com/sebastianbergmann/phpunit/issues/4306): Exceptions during code coverage driver initialization are not handled correctly
## [8.5.6] - 2020-06-15
### Fixed
* [#4211](https://github.com/sebastianbergmann/phpunit/issues/4211): `phpdbg_*()` functions are scoped to `PHPUnit\phpdbg_*()`
## [8.5.5] - 2020-05-22
### Fixed
* [#4033](https://github.com/sebastianbergmann/phpunit/issues/4033): Unexpected behaviour when `$GLOBALS` is deleted
## [8.5.4] - 2020-04-23
### Changed
* Changed how `PHPUnit\TextUI\Command` passes warnings to `PHPUnit\TextUI\TestRunner`
## [8.5.3] - 2020-03-31
### Fixed
* [#4017](https://github.com/sebastianbergmann/phpunit/issues/4017): Do not suggest refactoring to something that is also deprecated
* [#4133](https://github.com/sebastianbergmann/phpunit/issues/4133): `expectExceptionMessageRegExp()` has been removed in PHPUnit 9 without a deprecation warning being given in PHPUnit 8
* [#4139](https://github.com/sebastianbergmann/phpunit/issues/4139): Cannot double interfaces that declare a constructor with PHP 8
* [#4144](https://github.com/sebastianbergmann/phpunit/issues/4144): Empty objects are converted to empty arrays in JSON comparison failure diff
## [8.5.2] - 2020-01-08
### Removed
* `eval-stdin.php` has been removed, it was not used anymore since PHPUnit 7.2.7
## [8.5.1] - 2019-12-25
### Changed
* `eval-stdin.php` can now only be executed with `cli` and `phpdbg`
### Fixed
* [#3983](https://github.com/sebastianbergmann/phpunit/issues/3983): Deprecation warning given too eagerly
## [8.5.0] - 2019-12-06
### Added
* [#3911](https://github.com/sebastianbergmann/phpunit/issues/3911): Support combined use of `addMethods()` and `onlyMethods()`
* [#3949](https://github.com/sebastianbergmann/phpunit/issues/3949): Introduce specialized assertions `assertFileEqualsCanonicalizing()`, `assertFileEqualsIgnoringCase()`, `assertStringEqualsFileCanonicalizing()`, `assertStringEqualsFileIgnoringCase()`, `assertFileNotEqualsCanonicalizing()`, `assertFileNotEqualsIgnoringCase()`, `assertStringNotEqualsFileCanonicalizing()`, and `assertStringNotEqualsFileIgnoringCase()` as alternative to using `assertFileEquals()` etc. with optional parameters
### Changed
* [#3860](https://github.com/sebastianbergmann/phpunit/pull/3860): Deprecate invoking PHPUnit commandline test runner with just a class name
* [#3950](https://github.com/sebastianbergmann/phpunit/issues/3950): Deprecate optional parameters of `assertFileEquals()` etc.
* [#3955](https://github.com/sebastianbergmann/phpunit/issues/3955): Deprecate support for doubling multiple interfaces
### Fixed
* [#3953](https://github.com/sebastianbergmann/phpunit/issues/3953): Code Coverage for test executed in isolation does not work when the PHAR is used
* [#3967](https://github.com/sebastianbergmann/phpunit/issues/3967): Cannot double interface that extends interface that extends `\Throwable`
* [#3968](https://github.com/sebastianbergmann/phpunit/pull/3968): Test class run in a separate PHP process are passing when `exit` called inside
[8.5.13]: https://github.com/sebastianbergmann/phpunit/compare/8.5.12...8.5.13
[8.5.12]: https://github.com/sebastianbergmann/phpunit/compare/8.5.11...8.5.12
[8.5.11]: https://github.com/sebastianbergmann/phpunit/compare/8.5.10...8.5.11
[8.5.10]: https://github.com/sebastianbergmann/phpunit/compare/8.5.9...8.5.10
[8.5.9]: https://github.com/sebastianbergmann/phpunit/compare/8.5.8...8.5.9
[8.5.8]: https://github.com/sebastianbergmann/phpunit/compare/8.5.7...8.5.8
[8.5.7]: https://github.com/sebastianbergmann/phpunit/compare/8.5.6...8.5.7
[8.5.6]: https://github.com/sebastianbergmann/phpunit/compare/8.5.5...8.5.6
[8.5.5]: https://github.com/sebastianbergmann/phpunit/compare/8.5.4...8.5.5
[8.5.4]: https://github.com/sebastianbergmann/phpunit/compare/8.5.3...8.5.4
[8.5.3]: https://github.com/sebastianbergmann/phpunit/compare/8.5.2...8.5.3
[8.5.2]: https://github.com/sebastianbergmann/phpunit/compare/8.5.1...8.5.2
[8.5.1]: https://github.com/sebastianbergmann/phpunit/compare/8.5.0...8.5.1
[8.5.0]: https://github.com/sebastianbergmann/phpunit/compare/8.4.3...8.5.0
+1 -1
View File
@@ -1,6 +1,6 @@
PHPUnit
Copyright (c) 2001-2019, Sebastian Bergmann <sebastian@phpunit.de>.
Copyright (c) 2001-2020, Sebastian Bergmann <sebastian@phpunit.de>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
+6 -5
View File
@@ -3,17 +3,18 @@
PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of the xUnit architecture for unit testing frameworks.
[![Latest Stable Version](https://img.shields.io/packagist/v/phpunit/phpunit.svg?style=flat-square)](https://packagist.org/packages/phpunit/phpunit)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.1-8892BF.svg?style=flat-square)](https://php.net/)
[![CI Status](https://github.com/sebastianbergmann/phpunit/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/phpunit/actions)
[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.2-8892BF.svg?style=flat-square)](https://php.net/)
[![CI Status](https://github.com/sebastianbergmann/phpunit/workflows/CI/badge.svg?branch=8.5&event=push)](https://phpunit.de/build-status.html)
[![Type Coverage](https://shepherd.dev/github/sebastianbergmann/phpunit/coverage.svg)](https://shepherd.dev/github/sebastianbergmann/phpunit)
## Installation
We distribute a [PHP Archive (PHAR)](https://php.net/phar) that has all required (as well as some optional) dependencies of PHPUnit 7.5 bundled in a single file:
We distribute a [PHP Archive (PHAR)](https://php.net/phar) that has all required (as well as some optional) dependencies of PHPUnit 8.5 bundled in a single file:
```bash
$ wget https://phar.phpunit.de/phpunit-7.5.phar
$ wget https://phar.phpunit.de/phpunit-8.5.phar
$ php phpunit-7.5.phar --version
$ php phpunit-8.5.phar --version
```
Alternatively, you may use [Composer](https://getcomposer.org/) to download and install PHPUnit as well as its dependencies. Please refer to the "[Getting Started](https://phpunit.de/getting-started-with-phpunit.html)" guide for details on how to install PHPUnit.
-428
View File
@@ -1,428 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="phpunit" default="setup">
<target name="setup" depends="clean,install-dependencies"/>
<target name="validate" depends="php-syntax-check,validate-composer-json,validate-phpunit-xsd"/>
<target name="clean" unless="clean.done" description="Cleanup build artifacts">
<delete dir="${basedir}/bin"/>
<delete dir="${basedir}/vendor"/>
<delete file="${basedir}/composer.lock"/>
<delete dir="${basedir}/build/documentation"/>
<delete dir="${basedir}/build/logfiles"/>
<delete dir="${basedir}/build/phar"/>
<delete>
<fileset dir="${basedir}/build">
<include name="**/phpunit*.phar"/>
<include name="**/phpunit*.phar.asc"/>
</fileset>
</delete>
<property name="clean.done" value="true"/>
</target>
<target name="prepare" unless="prepare.done" depends="clean" description="Prepare for build">
<mkdir dir="${basedir}/build/documentation"/>
<mkdir dir="${basedir}/build/logfiles"/>
<property name="prepare.done" value="true"/>
</target>
<target name="validate-composer-json" depends="clean" unless="validate-composer-json.done" description="Validate composer.json">
<exec executable="${basedir}/tools/composer" failonerror="true" taskname="composer">
<arg value="validate"/>
<arg value="--strict"/>
<arg value="${basedir}/composer.json"/>
</exec>
<property name="validate-composer-json.done" value="true"/>
</target>
<target name="-dependencies-installed">
<available file="${basedir}/composer.lock" property="dependencies-installed"/>
</target>
<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}/tools/composer" taskname="composer">
<arg value="require"/>
<arg value="--no-update"/>
<arg value="phpunit/php-invoker:^2.0"/>
</exec>
<exec executable="${basedir}/tools/composer" taskname="composer">
<arg value="update"/>
<arg value="--no-interaction"/>
<arg value="--no-progress"/>
<arg value="--no-ansi"/>
<arg value="--no-suggest"/>
</exec>
<move file="${basedir}/composer.json.bak" tofile="${basedir}/composer.json"/>
</target>
<target name="check-dependencies" description="Performs check for outdated dependencies">
<exec executable="${basedir}/tools/composer" taskname="composer">
<arg value="show"/>
<arg value="--minor-only"/>
<arg value="--latest"/>
<arg value="--direct"/>
<arg value="--outdated"/>
<arg value="--strict"/>
</exec>
</target>
<target name="php-syntax-check" unless="php-syntax-check.done" description="Perform syntax check on PHP files">
<apply executable="php" failonerror="true" taskname="lint">
<arg value="-l"/>
<fileset dir="${basedir}/src">
<include name="**/*.php"/>
<modified/>
</fileset>
<fileset dir="${basedir}/tests">
<include name="**/*.php"/>
<modified/>
</fileset>
</apply>
<property name="php-syntax-check.done" value="true"/>
</target>
<target name="validate-phpunit-xsd" unless="validate-phpunit-xsd.done" description="Validate phpunit.xsd">
<exec executable="xmllint" failonerror="true" taskname="xmllint">
<arg value="--noout"/>
<arg path="${basedir}/phpunit.xsd"/>
</exec>
<property name="validate-phpunit-xsd.done" value="true"/>
</target>
<target name="test" depends="validate,install-dependencies" description="Run tests">
<exec executable="${basedir}/phpunit" taskname="phpunit"/>
</target>
<target name="signed-phar" depends="phar" description="Create signed PHAR archive of PHPUnit and all its dependencies">
<exec executable="gpg" failonerror="true">
<arg value="--local-user"/>
<arg value="sb@sebastian-bergmann.de"/>
<arg value="--armor"/>
<arg value="--detach-sign"/>
<arg path="${basedir}/build/phpunit-library-${version}.phar"/>
</exec>
<exec executable="gpg" failonerror="true">
<arg value="--local-user"/>
<arg value="sb@sebastian-bergmann.de"/>
<arg value="--armor"/>
<arg value="--detach-sign"/>
<arg path="${basedir}/build/phpunit-${version}.phar"/>
</exec>
</target>
<target name="phar" depends="-phar-prepare,-phar-determine-version" description="Create PHAR archive of PHPUnit and all its dependencies">
<antcall target="-phar-build">
<param name="type" value="release"/>
</antcall>
</target>
<target name="phar-nightly" depends="-phar-prepare" description="Create PHAR archive of PHPUnit and all its dependencies (nightly)">
<antcall target="-phar-build">
<param name="type" value="nightly"/>
</antcall>
</target>
<target name="-phar-prepare" depends="clean,install-dependencies">
<mkdir dir="${basedir}/build/phar"/>
<copy file="${basedir}/phpunit.xsd" tofile="${basedir}/build/phar/phpunit.xsd"/>
<exec executable="${basedir}/build/phar-manifest.php" output="${basedir}/build/phar/manifest.txt" failonerror="true"/>
<copy file="${basedir}/vendor/phpunit/php-code-coverage/LICENSE" tofile="${basedir}/build/phar/php-code-coverage/LICENSE"/>
<copy todir="${basedir}/build/phar/php-code-coverage">
<fileset dir="${basedir}/vendor/phpunit/php-code-coverage/src">
<include name="**/*" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpunit/php-file-iterator/LICENSE" tofile="${basedir}/build/phar/php-file-iterator/LICENSE"/>
<copy todir="${basedir}/build/phar/php-file-iterator">
<fileset dir="${basedir}/vendor/phpunit/php-file-iterator/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy todir="${basedir}/build/phar/php-invoker">
<fileset dir="${basedir}/vendor/phpunit/php-invoker/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpunit/php-text-template/LICENSE" tofile="${basedir}/build/phar/php-text-template/LICENSE"/>
<copy todir="${basedir}/build/phar/php-text-template">
<fileset dir="${basedir}/vendor/phpunit/php-text-template/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpunit/php-timer/LICENSE" tofile="${basedir}/build/phar/php-timer/LICENSE"/>
<copy todir="${basedir}/build/phar/php-timer">
<fileset dir="${basedir}/vendor/phpunit/php-timer/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpunit/php-token-stream/LICENSE" tofile="${basedir}/build/phar/php-token-stream/LICENSE"/>
<copy todir="${basedir}/build/phar/php-token-stream">
<fileset dir="${basedir}/vendor/phpunit/php-token-stream/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/code-unit-reverse-lookup/LICENSE" tofile="${basedir}/build/phar/sebastian-code-unit-reverse-lookup/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-code-unit-reverse-lookup">
<fileset dir="${basedir}/vendor/sebastian/code-unit-reverse-lookup/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/comparator/LICENSE" tofile="${basedir}/build/phar/sebastian-comparator/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-comparator">
<fileset dir="${basedir}/vendor/sebastian/comparator/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/diff/LICENSE" tofile="${basedir}/build/phar/sebastian-diff/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-diff">
<fileset dir="${basedir}/vendor/sebastian/diff/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/environment/LICENSE" tofile="${basedir}/build/phar/sebastian-environment/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-environment">
<fileset dir="${basedir}/vendor/sebastian/environment/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/exporter/LICENSE" tofile="${basedir}/build/phar/sebastian-exporter/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-exporter">
<fileset dir="${basedir}/vendor/sebastian/exporter/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/global-state/LICENSE" tofile="${basedir}/build/phar/sebastian-global-state/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-global-state">
<fileset dir="${basedir}/vendor/sebastian/global-state/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/object-enumerator/LICENSE" tofile="${basedir}/build/phar/object-enumerator/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-object-enumerator">
<fileset dir="${basedir}/vendor/sebastian/object-enumerator/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/object-reflector/LICENSE" tofile="${basedir}/build/phar/object-reflector/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-object-reflector">
<fileset dir="${basedir}/vendor/sebastian/object-reflector/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/recursion-context/LICENSE" tofile="${basedir}/build/phar/sebastian-recursion-context/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-recursion-context">
<fileset dir="${basedir}/vendor/sebastian/recursion-context/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/resource-operations/LICENSE" tofile="${basedir}/build/phar/sebastian-resource-operations/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-resource-operations">
<fileset dir="${basedir}/vendor/sebastian/resource-operations/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/sebastian/version/LICENSE" tofile="${basedir}/build/phar/sebastian-version/LICENSE"/>
<copy todir="${basedir}/build/phar/sebastian-version">
<fileset dir="${basedir}/vendor/sebastian/version/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/doctrine/instantiator/LICENSE" tofile="${basedir}/build/phar/doctrine-instantiator/LICENSE"/>
<copy todir="${basedir}/build/phar/doctrine-instantiator">
<fileset dir="${basedir}/vendor/doctrine/instantiator/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/myclabs/deep-copy/LICENSE" tofile="${basedir}/build/phar/myclabs-deep-copy/LICENSE"/>
<copy todir="${basedir}/build/phar/myclabs-deep-copy">
<fileset dir="${basedir}/vendor/myclabs/deep-copy/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phar-io/manifest/LICENSE" tofile="${basedir}/build/phar/phar-io-manifest/LICENSE"/>
<copy todir="${basedir}/build/phar/phar-io-manifest">
<fileset dir="${basedir}/vendor/phar-io/manifest/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phar-io/version/LICENSE" tofile="${basedir}/build/phar/phar-io-version/LICENSE"/>
<copy todir="${basedir}/build/phar/phar-io-version">
<fileset dir="${basedir}/vendor/phar-io/version/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpdocumentor/reflection-common/LICENSE" tofile="${basedir}/build/phar/phpdocumentor-reflection-common/LICENSE"/>
<copy todir="${basedir}/build/phar/phpdocumentor-reflection-common">
<fileset dir="${basedir}/vendor/phpdocumentor/reflection-common/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpdocumentor/reflection-docblock/LICENSE" tofile="${basedir}/build/phar/phpdocumentor-reflection-docblock/LICENSE"/>
<copy todir="${basedir}/build/phar/phpdocumentor-reflection-docblock">
<fileset dir="${basedir}/vendor/phpdocumentor/reflection-docblock/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpdocumentor/type-resolver/LICENSE" tofile="${basedir}/build/phar/phpdocumentor-type-resolver/LICENSE"/>
<copy todir="${basedir}/build/phar/phpdocumentor-type-resolver">
<fileset dir="${basedir}/vendor/phpdocumentor/type-resolver/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/phpspec/prophecy/LICENSE" tofile="${basedir}/build/phar/phpspec-prophecy/LICENSE"/>
<copy todir="${basedir}/build/phar/phpspec-prophecy">
<fileset dir="${basedir}/vendor/phpspec/prophecy/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/theseer/tokenizer/LICENSE" tofile="${basedir}/build/phar/theseer-tokenizer/LICENSE"/>
<copy todir="${basedir}/build/phar/theseer-tokenizer">
<fileset dir="${basedir}/vendor/theseer/tokenizer/src">
<include name="**/*.php" />
</fileset>
</copy>
<copy file="${basedir}/vendor/webmozart/assert/LICENSE" tofile="${basedir}/build/phar/webmozart-assert/LICENSE"/>
<copy todir="${basedir}/build/phar/webmozart-assert">
<fileset dir="${basedir}/vendor/webmozart/assert/src">
<include name="**/*.php" />
</fileset>
</copy>
</target>
<target name="-phar-build" depends="-phar-determine-version">
<copy todir="${basedir}/build/phar/phpunit">
<fileset dir="${basedir}/src">
<include name="**/*.php"/>
<include name="**/*.tpl*"/>
</fileset>
</copy>
<exec executable="${basedir}/build/phar-version.php" outputproperty="_version" failonerror="true">
<arg value="${version}"/>
<arg value="${type}"/>
</exec>
<exec executable="${basedir}/tools/phpab" taskname="phpab" failonerror="true">
<arg value="--all" />
<arg value="--static" />
<arg value="--once" />
<arg value="--phar" />
<arg value="--hash" />
<arg value="SHA-1" />
<arg value="--output" />
<arg path="${basedir}/build/phpunit-library-${_version}.phar" />
<arg value="--template" />
<arg path="${basedir}/build/library-phar-autoload.php.in" />
<arg path="${basedir}/build/phar" />
</exec>
<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}/tools/phpab" taskname="phpab" failonerror="true">
<arg value="--all" />
<arg value="--nolower" />
<arg value="--static" />
<arg value="--phar" />
<arg value="--hash" />
<arg value="SHA-1" />
<arg value="--output" />
<arg path="${basedir}/build/phpunit-${_version}.phar" />
<arg value="--template" />
<arg path="${basedir}/build/binary-phar-autoload.php" />
<arg path="${basedir}/build/phar" />
</exec>
<chmod file="${basedir}/build/phpunit-${_version}.phar" perm="ugo+rx"/>
<delete dir="${basedir}/build/phar"/>
<delete file="${basedir}/build/binary-phar-autoload.php"/>
</target>
<target name="-phar-determine-version">
<exec executable="${basedir}/build/version.php" outputproperty="version" failonerror="true" />
</target>
<target name="generate-project-documentation" depends="-phploc,-checkstyle,-phpunit">
<exec executable="${basedir}/tools/phpdox" dir="${basedir}/build" taskname="phpdox"/>
</target>
<target name="update-tools">
<exec executable="phive">
<arg value="--no-progress"/>
<arg value="update"/>
</exec>
<exec executable="${basedir}/tools/composer">
<arg value="self-update"/>
</exec>
</target>
<target name="-phploc" depends="prepare">
<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"/>
<arg path="${basedir}/src"/>
<arg path="${basedir}/tests"/>
</exec>
</target>
<target name="-checkstyle" depends="prepare">
<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"/>
<arg value="--format=checkstyle"/>
</exec>
</target>
<target name="-phpunit" depends="setup">
<exec executable="${basedir}/phpunit" taskname="phpunit">
<arg value="--coverage-xml"/>
<arg path="${basedir}/build/logfiles/coverage"/>
<arg value="--log-junit"/>
<arg path="${basedir}/build/logfiles/junit.xml"/>
</exec>
</target>
</project>
+20 -21
View File
@@ -21,45 +21,44 @@
},
"prefer-stable": true,
"require": {
"php": "^7.1",
"php": ">=7.2",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"doctrine/instantiator": "^1.1",
"myclabs/deep-copy": "^1.7",
"phar-io/manifest": "^1.0.2",
"phar-io/version": "^2.0",
"phpspec/prophecy": "^1.7",
"phpunit/php-code-coverage": "^6.0.7",
"phpunit/php-file-iterator": "^2.0.1",
"ext-xmlwriter": "*",
"doctrine/instantiator": "^1.3.1",
"myclabs/deep-copy": "^1.10.0",
"phar-io/manifest": "^2.0.1",
"phar-io/version": "^3.0.2",
"phpspec/prophecy": "^1.10.3",
"phpunit/php-code-coverage": "^7.0.12",
"phpunit/php-file-iterator": "^2.0.2",
"phpunit/php-text-template": "^1.2.1",
"phpunit/php-timer": "^2.1",
"sebastian/comparator": "^3.0",
"sebastian/diff": "^3.0",
"sebastian/environment": "^4.0",
"sebastian/exporter": "^3.1",
"sebastian/global-state": "^2.0",
"phpunit/php-timer": "^2.1.2",
"sebastian/comparator": "^3.0.2",
"sebastian/diff": "^3.0.2",
"sebastian/environment": "^4.2.3",
"sebastian/exporter": "^3.1.2",
"sebastian/global-state": "^3.0.0",
"sebastian/object-enumerator": "^3.0.3",
"sebastian/resource-operations": "^2.0",
"sebastian/resource-operations": "^2.0.1",
"sebastian/type": "^1.1.3",
"sebastian/version": "^2.0.1"
},
"require-dev": {
"ext-PDO": "*"
},
"conflict": {
"phpunit/phpunit-mock-objects": "*"
},
"config": {
"platform": {
"php": "7.1.0"
"php": "7.2.0"
},
"optimize-autoloader": true,
"sort-packages": true
},
"suggest": {
"phpunit/php-invoker": "^2.0",
"phpunit/php-invoker": "^2.0.0",
"ext-soap": "*",
"ext-xdebug": "*"
},
@@ -84,7 +83,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "7.5-dev"
"dev-master": "8.5-dev"
}
}
}
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpab" version="^1.25" installed="1.25.8" location="./tools/phpab" copy="true"/>
<phar name="php-cs-fixer" version="^2.16" installed="2.16.1" 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>
+3 -3
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env php
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,11 +9,11 @@
* file that was distributed with this source code.
*/
if (version_compare('7.1.0', PHP_VERSION, '>')) {
if (version_compare('7.2.0', PHP_VERSION, '>')) {
fwrite(
STDERR,
sprintf(
'This version of PHPUnit is supported on PHP 7.1, PHP 7.2, and PHP 7.3.' . PHP_EOL .
'This version of PHPUnit is supported on PHP 7.2, PHP 7.3, and PHP 7.4.' . PHP_EOL .
'You are using PHP %s (%s).' . PHP_EOL,
PHP_VERSION,
PHP_BINARY
-32
View File
@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="phpunit.xsd"
bootstrap="tests/bootstrap.php"
cacheResult="true"
colors="true"
verbose="true">
<testsuites>
<testsuite name="unit">
<directory suffix="Test.php">tests/unit</directory>
</testsuite>
<testsuite name="end-to-end">
<directory suffix=".phpt">tests/end-to-end</directory>
<exclude>tests/end-to-end/_files</exclude>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
<exclude>
<file>src/Framework/Assert/Functions.php</file>
<file>src/Util/PHP/eval-stdin.php</file>
</exclude>
</whitelist>
</filter>
<php>
<const name="PHPUNIT_TESTSUITE" value="true"/>
</php>
</phpunit>
+19 -9
View File
@@ -2,7 +2,7 @@
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:annotation>
<xs:documentation source="https://phpunit.de/documentation.html">
This Schema file defines the rules by which the XML configuration file of PHPUnit 7.5 may be structured.
This Schema file defines the rules by which the XML configuration file of PHPUnit 8.5 may be structured.
</xs:documentation>
<xs:appinfo source="https://phpunit.de/documentation.html"/>
</xs:annotation>
@@ -149,8 +149,8 @@
</xs:simpleType>
</xs:attribute>
<xs:attribute name="target" type="xs:anyURI"/>
<xs:attribute name="lowUpperBound" type="xs:nonNegativeInteger" default="35"/>
<xs:attribute name="highLowerBound" type="xs:nonNegativeInteger" default="70"/>
<xs:attribute name="lowUpperBound" type="xs:nonNegativeInteger" default="50"/>
<xs:attribute name="highLowerBound" type="xs:nonNegativeInteger" default="90"/>
<xs:attribute name="showUncoveredFiles" type="xs:boolean" default="false"/>
<xs:attribute name="showOnlySummary" type="xs:boolean" default="false"/>
<xs:attribute name="threshold" type="xs:nonNegativeInteger" default="30"/>
@@ -176,14 +176,22 @@
<xs:restriction base="xs:string">
<xs:enumeration value="default"/>
<xs:enumeration value="defects"/>
<xs:enumeration value="duration"/>
<xs:enumeration value="depends"/>
<xs:enumeration value="depends,defects"/>
<xs:enumeration value="random"/>
<xs:enumeration value="reverse"/>
<xs:enumeration value="depends,duration"/>
<xs:enumeration value="depends,random"/>
<xs:enumeration value="depends,reverse"/>
<xs:enumeration value="depends,duration"/>
<xs:enumeration value="depends,size"/>
<xs:enumeration value="duration"/>
<xs:enumeration value="no-depends"/>
<xs:enumeration value="no-depends,defects"/>
<xs:enumeration value="no-depends,duration"/>
<xs:enumeration value="no-depends,random"/>
<xs:enumeration value="no-depends,reverse"/>
<xs:enumeration value="no-depends,size"/>
<xs:enumeration value="random"/>
<xs:enumeration value="reverse"/>
<xs:enumeration value="size"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name="fileFilterType">
@@ -231,7 +239,7 @@
<xs:attribute name="backupGlobals" type="xs:boolean" default="false"/>
<xs:attribute name="backupStaticAttributes" type="xs:boolean" default="false"/>
<xs:attribute name="bootstrap" type="xs:anyURI"/>
<xs:attribute name="cacheResult" type="xs:boolean" default="false"/>
<xs:attribute name="cacheResult" type="xs:boolean" default="true"/>
<xs:attribute name="cacheResultFile" type="xs:anyURI"/>
<xs:attribute name="cacheTokens" type="xs:boolean" default="false"/>
<xs:attribute name="colors" type="xs:boolean" default="false"/>
@@ -270,12 +278,14 @@
<xs:attribute name="testSuiteLoaderFile" type="xs:anyURI"/>
<xs:attribute name="defaultTestSuite" type="xs:string" default=""/>
<xs:attribute name="verbose" type="xs:boolean" default="false"/>
<xs:attribute name="testdox" type="xs:boolean" default="false"/>
<xs:attribute name="stderr" type="xs:boolean" default="false"/>
<xs:attribute name="reverseDefectList" type="xs:boolean" default="false"/>
<xs:attribute name="registerMockObjectsFromTestArgumentsRecursively" type="xs:boolean" default="false"/>
<xs:attribute name="extensionsDirectory" type="xs:string"/>
<xs:attribute name="executionOrder" type="executionOrderType" default="default"/>
<xs:attribute name="resolveDependencies" type="xs:boolean" default="false"/>
<xs:attribute name="resolveDependencies" type="xs:boolean" default="true"/>
<xs:attribute name="noInteraction" type="xs:boolean" default="false"/>
</xs:attributeGroup>
<xs:group name="configGroup">
<xs:all>
+2 -2
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -10,7 +10,7 @@
namespace PHPUnit;
/**
* Marker interface for PHPUnit exceptions.
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
interface Exception extends \Throwable
{
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -19,7 +19,7 @@ use ArrayAccess;
*
* The array key is passed in the constructor.
*/
class ArrayHasKey extends Constraint
final class ArrayHasKey extends Constraint
{
/**
* @var int|string
@@ -31,7 +31,6 @@ class ArrayHasKey extends Constraint
*/
public function __construct($key)
{
parent::__construct();
$this->key = $key;
}
@@ -42,7 +41,7 @@ class ArrayHasKey extends Constraint
*/
public function toString(): string
{
return 'has the key ' . $this->exporter->export($this->key);
return 'has the key ' . $this->exporter()->export($this->key);
}
/**
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -18,9 +18,11 @@ use SebastianBergmann\Comparator\ComparisonFailure;
* Uses array_replace_recursive() to check if a key value subset is part of the
* subject array.
*
* @codeCoverageIgnore
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3494
*/
class ArraySubset extends Constraint
final class ArraySubset extends Constraint
{
/**
* @var iterable
@@ -34,8 +36,6 @@ class ArraySubset extends Constraint
public function __construct(iterable $subset, bool $strict = false)
{
parent::__construct();
$this->strict = $strict;
$this->subset = $subset;
}
@@ -50,14 +50,10 @@ class ArraySubset extends Constraint
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
//type cast $other & $this->subset as an array to allow
//support in standard array functions.
@@ -95,7 +91,7 @@ class ArraySubset extends Constraint
*/
public function toString(): string
{
return 'has the subset ' . $this->exporter->export($this->subset);
return 'has the subset ' . $this->exporter()->export($this->subset);
}
/**
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,11 @@ namespace PHPUnit\Framework\Constraint;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\ExpectationFailedException;
class Attribute extends Composite
/**
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
* @codeCoverageIgnore
*/
final class Attribute extends Composite
{
/**
* @var string
@@ -36,15 +40,11 @@ class Attribute extends Composite
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
* @throws \PHPUnit\Framework\Exception
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
return parent::evaluate(
Assert::readAttribute(
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\Constraint;
/**
* Constraint that evaluates against a specified closure.
*/
class Callback extends Constraint
final class Callback extends Constraint
{
/**
* @var callable
@@ -21,8 +21,6 @@ class Callback extends Constraint
public function __construct(callable $callback)
{
parent::__construct();
$this->callback = $callback;
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,7 +9,7 @@
*/
namespace PHPUnit\Framework\Constraint;
use ReflectionClass;
use PHPUnit\Framework\Exception;
/**
* Constraint that asserts that the class it is evaluated for has a given
@@ -26,8 +26,6 @@ class ClassHasAttribute extends Constraint
public function __construct(string $attributeName)
{
parent::__construct();
$this->attributeName = $attributeName;
}
@@ -50,9 +48,17 @@ class ClassHasAttribute extends Constraint
*/
protected function matches($other): bool
{
$class = new ReflectionClass($other);
return $class->hasProperty($this->attributeName);
try {
return (new \ReflectionClass($other))->hasProperty($this->attributeName);
// @codeCoverageIgnoreStart
} catch (\ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e
);
}
// @codeCoverageIgnoreEnd
}
/**
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,7 +9,7 @@
*/
namespace PHPUnit\Framework\Constraint;
use ReflectionClass;
use PHPUnit\Framework\Exception;
/**
* Constraint that asserts that the class it is evaluated for has a given
@@ -17,7 +17,7 @@ use ReflectionClass;
*
* The attribute name is passed in the constructor.
*/
class ClassHasStaticAttribute extends ClassHasAttribute
final class ClassHasStaticAttribute extends ClassHasAttribute
{
/**
* Returns a string representation of the constraint.
@@ -38,13 +38,21 @@ class ClassHasStaticAttribute extends ClassHasAttribute
*/
protected function matches($other): bool
{
$class = new ReflectionClass($other);
try {
$class = new \ReflectionClass($other);
if ($class->hasProperty($this->attributeName())) {
$attribute = $class->getProperty($this->attributeName());
return $attribute->isStatic();
if ($class->hasProperty($this->attributeName())) {
return $class->getProperty($this->attributeName())->isStatic();
}
// @codeCoverageIgnoreStart
} catch (\ReflectionException $e) {
throw new Exception(
$e->getMessage(),
(int) $e->getCode(),
$e
);
}
// @codeCoverageIgnoreEnd
return false;
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -11,6 +11,10 @@ namespace PHPUnit\Framework\Constraint;
use PHPUnit\Framework\ExpectationFailedException;
/**
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
* @codeCoverageIgnore
*/
abstract class Composite extends Constraint
{
/**
@@ -20,8 +24,6 @@ abstract class Composite extends Constraint
public function __construct(Constraint $innerConstraint)
{
parent::__construct();
$this->innerConstraint = $innerConstraint;
}
@@ -35,14 +37,10 @@ abstract class Composite extends Constraint
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
try {
return $this->innerConstraint->evaluate(
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -20,12 +20,10 @@ use SebastianBergmann\Exporter\Exporter;
*/
abstract class Constraint implements Countable, SelfDescribing
{
protected $exporter;
public function __construct()
{
$this->exporter = new Exporter;
}
/**
* @var Exporter
*/
private $exporter;
/**
* Evaluates the constraint for parameter $other
@@ -37,14 +35,10 @@ abstract class Constraint implements Countable, SelfDescribing
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
$success = false;
@@ -69,6 +63,15 @@ abstract class Constraint implements Countable, SelfDescribing
return 1;
}
protected function exporter(): Exporter
{
if ($this->exporter === null) {
$this->exporter = new Exporter;
}
return $this->exporter;
}
/**
* Evaluates the constraint for parameter $other. Returns true if the
* constraint is met, false otherwise.
@@ -76,6 +79,7 @@ abstract class Constraint implements Countable, SelfDescribing
* This method can be overridden to implement the evaluation algorithm.
*
* @param mixed $other value or object to evaluate
* @codeCoverageIgnore
*/
protected function matches($other): bool
{
@@ -91,6 +95,8 @@ abstract class Constraint implements Countable, SelfDescribing
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @psalm-return never-return
*/
protected function fail($other, $description, ComparisonFailure $comparisonFailure = null): void
{
@@ -143,6 +149,6 @@ abstract class Constraint implements Countable, SelfDescribing
*/
protected function failureDescription($other): string
{
return $this->exporter->export($other) . ' ' . $this->toString();
return $this->exporter()->export($other) . ' ' . $this->toString();
}
}
+4 -4
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -24,8 +24,6 @@ class Count extends Constraint
public function __construct(int $expected)
{
parent::__construct();
$this->expectedCount = $expected;
}
@@ -89,6 +87,8 @@ class Count extends Constraint
return $count;
}
return null;
}
/**
@@ -98,7 +98,7 @@ class Count extends Constraint
protected function getCountOfGenerator(Generator $generator): int
{
for ($count = 0; $generator->valid(); $generator->next()) {
++$count;
$count++;
}
return $count;
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ namespace PHPUnit\Framework\Constraint;
*
* The file path to check is passed as $other in evaluate().
*/
class DirectoryExists extends Constraint
final class DirectoryExists extends Constraint
{
/**
* Returns a string representation of the constraint.
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\Constraint;
use PHPUnit\Util\Filter;
use Throwable;
class Exception extends Constraint
final class Exception extends Constraint
{
/**
* @var string
@@ -21,8 +21,6 @@ class Exception extends Constraint
public function __construct(string $className)
{
parent::__construct();
$this->className = $className;
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,7 +9,7 @@
*/
namespace PHPUnit\Framework\Constraint;
class ExceptionCode extends Constraint
final class ExceptionCode extends Constraint
{
/**
* @var int|string
@@ -21,8 +21,6 @@ class ExceptionCode extends Constraint
*/
public function __construct($expected)
{
parent::__construct();
$this->expectedCode = $expected;
}
@@ -56,8 +54,8 @@ class ExceptionCode extends Constraint
{
return \sprintf(
'%s is equal to expected exception code %s',
$this->exporter->export($other->getCode()),
$this->exporter->export($this->expectedCode)
$this->exporter()->export($other->getCode()),
$this->exporter()->export($this->expectedCode)
);
}
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,7 +9,7 @@
*/
namespace PHPUnit\Framework\Constraint;
class ExceptionMessage extends Constraint
final class ExceptionMessage extends Constraint
{
/**
* @var string
@@ -18,8 +18,6 @@ class ExceptionMessage extends Constraint
public function __construct(string $expected)
{
parent::__construct();
$this->expectedMessage = $expected;
}
@@ -44,7 +42,7 @@ class ExceptionMessage extends Constraint
return $other->getMessage() === '';
}
return \strpos($other->getMessage(), $this->expectedMessage) !== false;
return \strpos((string) $other->getMessage(), $this->expectedMessage) !== false;
}
/**
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -11,7 +11,7 @@ namespace PHPUnit\Framework\Constraint;
use PHPUnit\Util\RegularExpression as RegularExpressionUtil;
class ExceptionMessageRegularExpression extends Constraint
final class ExceptionMessageRegularExpression extends Constraint
{
/**
* @var string
@@ -20,8 +20,6 @@ class ExceptionMessageRegularExpression extends Constraint
public function __construct(string $expected)
{
parent::__construct();
$this->expectedMessageRegExp = $expected;
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ namespace PHPUnit\Framework\Constraint;
*
* The file path to check is passed as $other in evaluate().
*/
class FileExists extends Constraint
final class FileExists extends Constraint
{
/**
* Returns a string representation of the constraint.
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -13,7 +13,7 @@ namespace PHPUnit\Framework\Constraint;
* Constraint that asserts that the value it is evaluated for is greater
* than a given value.
*/
class GreaterThan extends Constraint
final class GreaterThan extends Constraint
{
/**
* @var float|int
@@ -25,8 +25,6 @@ class GreaterThan extends Constraint
*/
public function __construct($value)
{
parent::__construct();
$this->value = $value;
}
@@ -37,7 +35,7 @@ class GreaterThan extends Constraint
*/
public function toString(): string
{
return 'is greater than ' . $this->exporter->export($this->value);
return 'is greater than ' . $this->exporter()->export($this->value);
}
/**
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ use PHPUnit\Framework\ExpectationFailedException;
/**
* Constraint that accepts any input value.
*/
class IsAnything extends Constraint
final class IsAnything extends Constraint
{
/**
* Evaluates the constraint for parameter $other
@@ -26,13 +26,9 @@ class IsAnything extends Constraint
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
return $returnResult ? true : null;
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ use Countable;
/**
* Constraint that checks whether a variable is empty().
*/
class IsEmpty extends Constraint
final class IsEmpty extends Constraint
{
/**
* Returns a string representation of the constraint.
@@ -57,7 +57,7 @@ class IsEmpty extends Constraint
return \sprintf(
'%s %s %s',
$type[0] == 'a' || $type[0] == 'o' ? 'an' : 'a',
\strpos($type, 'a') === 0 || \strpos($type, 'o') === 0 ? 'an' : 'a',
$type,
$this->toString()
);
+4 -16
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -22,7 +22,7 @@ use SebastianBergmann\Comparator\Factory as ComparatorFactory;
*
* The expected value is passed in the constructor.
*/
class IsEqual extends Constraint
final class IsEqual extends Constraint
{
/**
* @var mixed
@@ -34,11 +34,6 @@ class IsEqual extends Constraint
*/
private $delta;
/**
* @var int
*/
private $maxDepth;
/**
* @var bool
*/
@@ -51,11 +46,8 @@ class IsEqual extends Constraint
public function __construct($value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false)
{
parent::__construct();
$this->value = $value;
$this->delta = $delta;
$this->maxDepth = $maxDepth;
$this->canonicalize = $canonicalize;
$this->ignoreCase = $ignoreCase;
}
@@ -70,13 +62,9 @@ class IsEqual extends Constraint
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
// If $this->value and $other are identical, they are also equal.
// This is the most common path and will allow us to skip
@@ -143,7 +131,7 @@ class IsEqual extends Constraint
return \sprintf(
'is equal to %s%s',
$this->exporter->export($this->value),
$this->exporter()->export($this->value),
$delta
);
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\Constraint;
/**
* Constraint that accepts false.
*/
class IsFalse extends Constraint
final class IsFalse extends Constraint
{
/**
* Returns a string representation of the constraint.
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\Constraint;
/**
* Constraint that accepts finite.
*/
class IsFinite extends Constraint
final class IsFinite extends Constraint
{
/**
* Returns a string representation of the constraint.
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -23,7 +23,7 @@ use SebastianBergmann\Comparator\ComparisonFailure;
*
* The expected value is passed in the constructor.
*/
class IsIdentical extends Constraint
final class IsIdentical extends Constraint
{
/**
* @var float
@@ -37,8 +37,6 @@ class IsIdentical extends Constraint
public function __construct($value)
{
parent::__construct();
$this->value = $value;
}
@@ -52,14 +50,10 @@ class IsIdentical extends Constraint
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
if (\is_float($this->value) && \is_float($other) &&
!\is_infinite($this->value) && !\is_infinite($other) &&
@@ -91,8 +85,8 @@ class IsIdentical extends Constraint
$f = new ComparisonFailure(
$this->value,
$other,
$this->exporter->export($this->value),
$this->exporter->export($other)
$this->exporter()->export($this->value),
$this->exporter()->export($other)
);
}
@@ -112,7 +106,7 @@ class IsIdentical extends Constraint
\get_class($this->value) . '"';
}
return 'is identical to ' . $this->exporter->export($this->value);
return 'is identical to ' . $this->exporter()->export($this->value);
}
/**
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\Constraint;
/**
* Constraint that accepts infinite.
*/
class IsInfinite extends Constraint
final class IsInfinite extends Constraint
{
/**
* Returns a string representation of the constraint.
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,16 +9,13 @@
*/
namespace PHPUnit\Framework\Constraint;
use ReflectionClass;
use ReflectionException;
/**
* Constraint that asserts that the object it is evaluated for is an instance
* of a given class.
*
* The expected class name is passed in the constructor.
*/
class IsInstanceOf extends Constraint
final class IsInstanceOf extends Constraint
{
/**
* @var string
@@ -27,8 +24,6 @@ class IsInstanceOf extends Constraint
public function __construct(string $className)
{
parent::__construct();
$this->className = $className;
}
@@ -69,7 +64,7 @@ class IsInstanceOf extends Constraint
{
return \sprintf(
'%s is an instance of %s "%s"',
$this->exporter->shortenedExport($other),
$this->exporter()->shortenedExport($other),
$this->getType(),
$this->className
);
@@ -78,12 +73,12 @@ class IsInstanceOf extends Constraint
private function getType(): string
{
try {
$reflection = new ReflectionClass($this->className);
$reflection = new \ReflectionClass($this->className);
if ($reflection->isInterface()) {
return 'interface';
}
} catch (ReflectionException $e) {
} catch (\ReflectionException $e) {
}
return 'class';
+4 -4
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\Constraint;
/**
* Constraint that asserts that a string is valid JSON.
*/
class IsJson extends Constraint
final class IsJson extends Constraint
{
/**
* Returns a string representation of the constraint.
@@ -61,12 +61,12 @@ class IsJson extends Constraint
\json_decode($other);
$error = JsonMatchesErrorMessageProvider::determineJsonError(
\json_last_error()
(string) \json_last_error()
);
return \sprintf(
'%s is valid JSON (%s)',
$this->exporter->shortenedExport($other),
$this->exporter()->shortenedExport($other),
$error
);
}
+2 -2
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\Constraint;
/**
* Constraint that accepts nan.
*/
class IsNan extends Constraint
final class IsNan extends Constraint
{
/**
* Returns a string representation of the constraint.
+2 -2
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\Constraint;
/**
* Constraint that accepts null.
*/
class IsNull extends Constraint
final class IsNull extends Constraint
{
/**
* Returns a string representation of the constraint.
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ namespace PHPUnit\Framework\Constraint;
*
* The file path to check is passed as $other in evaluate().
*/
class IsReadable extends Constraint
final class IsReadable extends Constraint
{
/**
* Returns a string representation of the constraint.
+2 -2
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\Constraint;
/**
* Constraint that accepts true.
*/
class IsTrue extends Constraint
final class IsTrue extends Constraint
{
/**
* Returns a string representation of the constraint.
+62 -15
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -15,34 +15,70 @@ namespace PHPUnit\Framework\Constraint;
*
* The expected value is passed in the constructor.
*/
class IsType extends Constraint
final class IsType extends Constraint
{
public const TYPE_ARRAY = 'array';
/**
* @var string
*/
public const TYPE_ARRAY = 'array';
public const TYPE_BOOL = 'bool';
/**
* @var string
*/
public const TYPE_BOOL = 'bool';
public const TYPE_FLOAT = 'float';
/**
* @var string
*/
public const TYPE_FLOAT = 'float';
public const TYPE_INT = 'int';
/**
* @var string
*/
public const TYPE_INT = 'int';
public const TYPE_NULL = 'null';
/**
* @var string
*/
public const TYPE_NULL = 'null';
public const TYPE_NUMERIC = 'numeric';
/**
* @var string
*/
public const TYPE_NUMERIC = 'numeric';
public const TYPE_OBJECT = 'object';
/**
* @var string
*/
public const TYPE_OBJECT = 'object';
/**
* @var string
*/
public const TYPE_RESOURCE = 'resource';
public const TYPE_STRING = 'string';
/**
* @var string
*/
public const TYPE_STRING = 'string';
public const TYPE_SCALAR = 'scalar';
/**
* @var string
*/
public const TYPE_SCALAR = 'scalar';
/**
* @var string
*/
public const TYPE_CALLABLE = 'callable';
/**
* @var string
*/
public const TYPE_ITERABLE = 'iterable';
/**
* @var array
* @var array<string,bool>
*/
private const KNOWN_TYPES = [
'array' => true,
@@ -73,8 +109,6 @@ class IsType extends Constraint
*/
public function __construct(string $type)
{
parent::__construct();
if (!isset(self::KNOWN_TYPES[$type])) {
throw new \PHPUnit\Framework\Exception(
\sprintf(
@@ -137,7 +171,20 @@ class IsType extends Constraint
return \is_object($other);
case 'resource':
return \is_resource($other) || \is_string(@\get_resource_type($other));
if (\is_resource($other)) {
return true;
}
try {
$resource = @\get_resource_type($other);
if (\is_string($resource)) {
return true;
}
} catch (\TypeError $e) {
}
return false;
case 'scalar':
return \is_scalar($other);
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ namespace PHPUnit\Framework\Constraint;
*
* The file path to check is passed as $other in evaluate().
*/
class IsWritable extends Constraint
final class IsWritable extends Constraint
{
/**
* Returns a string representation of the constraint.
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -16,7 +16,7 @@ use SebastianBergmann\Comparator\ComparisonFailure;
/**
* Asserts whether or not two JSON objects are equal.
*/
class JsonMatches extends Constraint
final class JsonMatches extends Constraint
{
/**
* @var string
@@ -25,8 +25,6 @@ class JsonMatches extends Constraint
public function __construct(string $value)
{
parent::__construct();
$this->value = $value;
}
@@ -76,31 +74,29 @@ class JsonMatches extends Constraint
* @throws ExpectationFailedException
* @throws \PHPUnit\Framework\Exception
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*
* @psalm-return never-return
*/
protected function fail($other, $description, ComparisonFailure $comparisonFailure = null): void
{
if ($comparisonFailure === null) {
[$error] = Json::canonicalize($other);
[$error, $recodedOther] = Json::canonicalize($other);
if ($error) {
parent::fail($other, $description);
return;
}
[$error] = Json::canonicalize($this->value);
[$error, $recodedValue] = Json::canonicalize($this->value);
if ($error) {
parent::fail($other, $description);
return;
}
$comparisonFailure = new ComparisonFailure(
\json_decode($this->value),
\json_decode($other),
Json::prettify($this->value),
Json::prettify($other),
Json::prettify($recodedValue),
Json::prettify($recodedOther),
false,
'Failed asserting that two json values are equal.'
);
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -12,7 +12,7 @@ namespace PHPUnit\Framework\Constraint;
/**
* Provides human readable messages for each JSON error.
*/
class JsonMatchesErrorMessageProvider
final class JsonMatchesErrorMessageProvider
{
/**
* Translates JSON error to a human readable string.
@@ -32,6 +32,7 @@ class JsonMatchesErrorMessageProvider
return $prefix . 'Syntax error, malformed JSON';
case \JSON_ERROR_UTF8:
return $prefix . 'Malformed UTF-8 characters, possibly incorrectly encoded';
default:
return $prefix . 'Unknown error';
}
@@ -51,6 +52,7 @@ class JsonMatchesErrorMessageProvider
$prefix = 'Actual value JSON decode error - ';
break;
default:
$prefix = '';
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -13,7 +13,7 @@ namespace PHPUnit\Framework\Constraint;
* Constraint that asserts that the value it is evaluated for is less than
* a given value.
*/
class LessThan extends Constraint
final class LessThan extends Constraint
{
/**
* @var float|int
@@ -25,8 +25,6 @@ class LessThan extends Constraint
*/
public function __construct($value)
{
parent::__construct();
$this->value = $value;
}
@@ -37,7 +35,7 @@ class LessThan extends Constraint
*/
public function toString(): string
{
return 'is less than ' . $this->exporter->export($this->value);
return 'is less than ' . $this->exporter()->export($this->value);
}
/**
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ use PHPUnit\Framework\ExpectationFailedException;
/**
* Logical AND.
*/
class LogicalAnd extends Constraint
final class LogicalAnd extends Constraint
{
/**
* @var Constraint[]
@@ -61,14 +61,10 @@ class LogicalAnd extends Constraint
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
$success = true;
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ use PHPUnit\Framework\ExpectationFailedException;
/**
* Logical NOT.
*/
class LogicalNot extends Constraint
final class LogicalNot extends Constraint
{
/**
* @var Constraint
@@ -79,8 +79,6 @@ class LogicalNot extends Constraint
*/
public function __construct($constraint)
{
parent::__construct();
if (!($constraint instanceof Constraint)) {
$constraint = new IsEqual($constraint);
}
@@ -98,14 +96,10 @@ class LogicalNot extends Constraint
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
$success = !$this->constraint->evaluate($other, $description, true);
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ use PHPUnit\Framework\ExpectationFailedException;
/**
* Logical OR.
*/
class LogicalOr extends Constraint
final class LogicalOr extends Constraint
{
/**
* @var Constraint[]
@@ -58,14 +58,10 @@ class LogicalOr extends Constraint
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
$success = false;
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ use PHPUnit\Framework\ExpectationFailedException;
/**
* Logical XOR.
*/
class LogicalXor extends Constraint
final class LogicalXor extends Constraint
{
/**
* @var Constraint[]
@@ -58,14 +58,10 @@ class LogicalXor extends Constraint
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
$success = true;
$lastResult = null;
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -17,7 +17,7 @@ use ReflectionObject;
*
* The attribute name is passed in the constructor.
*/
class ObjectHasAttribute extends ClassHasAttribute
final class ObjectHasAttribute extends ClassHasAttribute
{
/**
* Evaluates the constraint for parameter $other. Returns true if the
@@ -27,8 +27,6 @@ class ObjectHasAttribute extends ClassHasAttribute
*/
protected function matches($other): bool
{
$object = new ReflectionObject($other);
return $object->hasProperty($this->attributeName());
return (new ReflectionObject($other))->hasProperty($this->attributeName());
}
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -27,8 +27,6 @@ class RegularExpression extends Constraint
public function __construct(string $pattern)
{
parent::__construct();
$this->pattern = $pattern;
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,7 +9,7 @@
*/
namespace PHPUnit\Framework\Constraint;
class SameSize extends Count
final class SameSize extends Count
{
public function __construct(iterable $expected)
{
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -18,7 +18,7 @@ namespace PHPUnit\Framework\Constraint;
*
* The sub-string is passed in the constructor.
*/
class StringContains extends Constraint
final class StringContains extends Constraint
{
/**
* @var string
@@ -32,8 +32,6 @@ class StringContains extends Constraint
public function __construct(string $string, bool $ignoreCase = false)
{
parent::__construct();
$this->string = $string;
$this->ignoreCase = $ignoreCase;
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -13,7 +13,7 @@ namespace PHPUnit\Framework\Constraint;
* Constraint that asserts that the string it is evaluated for ends with a given
* suffix.
*/
class StringEndsWith extends Constraint
final class StringEndsWith extends Constraint
{
/**
* @var string
@@ -22,8 +22,6 @@ class StringEndsWith extends Constraint
public function __construct(string $suffix)
{
parent::__construct();
$this->suffix = $suffix;
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,7 +14,7 @@ use SebastianBergmann\Diff\Differ;
/**
* ...
*/
class StringMatchesFormatDescription extends RegularExpression
final class StringMatchesFormatDescription extends RegularExpression
{
/**
* @var string
@@ -68,9 +68,7 @@ class StringMatchesFormatDescription extends RegularExpression
$this->string = \implode("\n", $from);
$other = \implode("\n", $to);
$differ = new Differ("--- Expected\n+++ Actual\n");
return $differ->diff($this->string, $other);
return (new Differ("--- Expected\n+++ Actual\n"))->diff($this->string, $other);
}
private function createPatternFromFormat(string $string): string
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,13 +9,13 @@
*/
namespace PHPUnit\Framework\Constraint;
use PHPUnit\Util\InvalidArgumentHelper;
use PHPUnit\Framework\InvalidArgumentException;
/**
* Constraint that asserts that the string it is evaluated for begins with a
* given prefix.
*/
class StringStartsWith extends Constraint
final class StringStartsWith extends Constraint
{
/**
* @var string
@@ -24,10 +24,8 @@ class StringStartsWith extends Constraint
public function __construct(string $prefix)
{
parent::__construct();
if (\strlen($prefix) === 0) {
throw InvalidArgumentHelper::factory(1, 'non-empty string');
throw InvalidArgumentException::create(1, 'non-empty string');
}
$this->prefix = $prefix;
@@ -49,6 +47,6 @@ class StringStartsWith extends Constraint
*/
protected function matches($other): bool
{
return \strpos($other, $this->prefix) === 0;
return \strpos((string) $other, $this->prefix) === 0;
}
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -14,8 +14,10 @@ use SplObjectStorage;
/**
* Constraint that asserts that the Traversable it is applied to contains
* a given value.
*
* @deprecated Use TraversableContainsEqual or TraversableContainsIdentical instead
*/
class TraversableContains extends Constraint
final class TraversableContains extends Constraint
{
/**
* @var bool
@@ -32,13 +34,8 @@ class TraversableContains extends Constraint
*/
private $value;
/**
* @throws \PHPUnit\Framework\Exception
*/
public function __construct($value, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false)
{
parent::__construct();
$this->checkForObjectIdentity = $checkForObjectIdentity;
$this->checkForNonObjectIdentity = $checkForNonObjectIdentity;
$this->value = $value;
@@ -55,7 +52,7 @@ class TraversableContains extends Constraint
return 'contains "' . $this->value . '"';
}
return 'contains ' . $this->exporter->export($this->value);
return 'contains ' . $this->exporter()->export($this->value);
}
/**
@@ -0,0 +1,84 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework\Constraint;
use SplObjectStorage;
/**
* Constraint that asserts that the Traversable it is applied to contains
* a given value (using non-strict comparison).
*/
final class TraversableContainsEqual extends Constraint
{
/**
* @var mixed
*/
private $value;
public function __construct($value)
{
$this->value = $value;
}
/**
* Returns a string representation of the constraint.
*
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function toString(): string
{
if (\is_string($this->value) && \strpos($this->value, "\n") !== false) {
return 'contains "' . $this->value . '"';
}
return 'contains ' . $this->exporter()->export($this->value);
}
/**
* Evaluates the constraint for parameter $other. Returns true if the
* constraint is met, false otherwise.
*
* @param mixed $other value or object to evaluate
*/
protected function matches($other): bool
{
if ($other instanceof SplObjectStorage) {
return $other->contains($this->value);
}
foreach ($other as $element) {
/* @noinspection TypeUnsafeComparisonInspection */
if ($this->value == $element) {
return true;
}
}
return false;
}
/**
* Returns the description of the failure
*
* The beginning of failure messages is "Failed asserting that" in most
* cases. This method should return the second part of that sentence.
*
* @param mixed $other evaluated value or object
*
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
protected function failureDescription($other): string
{
return \sprintf(
'%s %s',
\is_array($other) ? 'an array' : 'a traversable',
$this->toString()
);
}
}
@@ -0,0 +1,83 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework\Constraint;
use SplObjectStorage;
/**
* Constraint that asserts that the Traversable it is applied to contains
* a given value (using strict comparison).
*/
final class TraversableContainsIdentical extends Constraint
{
/**
* @var mixed
*/
private $value;
public function __construct($value)
{
$this->value = $value;
}
/**
* Returns a string representation of the constraint.
*
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function toString(): string
{
if (\is_string($this->value) && \strpos($this->value, "\n") !== false) {
return 'contains "' . $this->value . '"';
}
return 'contains ' . $this->exporter()->export($this->value);
}
/**
* Evaluates the constraint for parameter $other. Returns true if the
* constraint is met, false otherwise.
*
* @param mixed $other value or object to evaluate
*/
protected function matches($other): bool
{
if ($other instanceof SplObjectStorage) {
return $other->contains($this->value);
}
foreach ($other as $element) {
if ($this->value === $element) {
return true;
}
}
return false;
}
/**
* Returns the description of the failure
*
* The beginning of failure messages is "Failed asserting that" in most
* cases. This method should return the second part of that sentence.
*
* @param mixed $other evaluated value or object
*
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
protected function failureDescription($other): string
{
return \sprintf(
'%s %s',
\is_array($other) ? 'an array' : 'a traversable',
$this->toString()
);
}
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -15,7 +15,7 @@ use PHPUnit\Framework\ExpectationFailedException;
* Constraint that asserts that the Traversable it is applied to contains
* only values of a given type.
*/
class TraversableContainsOnly extends Constraint
final class TraversableContainsOnly extends Constraint
{
/**
* @var Constraint
@@ -32,8 +32,6 @@ class TraversableContainsOnly extends Constraint
*/
public function __construct(string $type, bool $isNativeType = true)
{
parent::__construct();
if ($isNativeType) {
$this->constraint = new IsType($type);
} else {
@@ -55,14 +53,10 @@ class TraversableContainsOnly extends Constraint
* a boolean value instead: true in case of success, false in case of a
* failure.
*
* @param mixed $other value or object to evaluate
* @param string $description Additional information about the test
* @param bool $returnResult Whether to return a result or throw an exception
*
* @throws ExpectationFailedException
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function evaluate($other, $description = '', $returnResult = false)
public function evaluate($other, string $description = '', bool $returnResult = false)
{
$success = true;
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,7 +9,12 @@
*/
namespace PHPUnit\Framework;
class DataProviderTestSuite extends TestSuite
use PHPUnit\Util\Test as TestUtil;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class DataProviderTestSuite extends TestSuite
{
/**
* @var string[]
@@ -41,4 +46,16 @@ class DataProviderTestSuite extends TestSuite
{
return \count($this->dependencies) > 0;
}
/**
* Returns the size of the each test created using the data provider(s)
*
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
*/
public function getSize(): int
{
[$className, $methodName] = \explode('::', $this->getName());
return TestUtil::getSize($className, $methodName);
}
}
+2 -3
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,7 +9,6 @@
*/
namespace PHPUnit\Framework\Error;
class Deprecated extends Error
final class Deprecated extends Error
{
public static $enabled = true;
}
+1 -4
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -11,9 +11,6 @@ namespace PHPUnit\Framework\Error;
use PHPUnit\Framework\Exception;
/**
* Wrapper for PHP errors.
*/
class Error extends Exception
{
public function __construct(string $message, int $code, string $file, int $line, \Exception $previous = null)
+2 -3
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,7 +9,6 @@
*/
namespace PHPUnit\Framework\Error;
class Notice extends Error
final class Notice extends Error
{
public static $enabled = true;
}
+2 -3
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,7 +9,6 @@
*/
namespace PHPUnit\Framework\Error;
class Warning extends Error
final class Warning extends Error
{
public static $enabled = true;
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -10,7 +10,7 @@
namespace PHPUnit\Framework;
/**
* Thrown when an assertion failed.
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class AssertionFailedError extends Exception implements SelfDescribing
{
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,6 +9,9 @@
*/
namespace PHPUnit\Framework;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class CodeCoverageException extends Exception
{
}
@@ -0,0 +1,17 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class CoveredCodeNotExecutedException extends RiskyTestError
{
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -30,6 +30,8 @@ use PHPUnit\Util\Filter;
* the parent would break the intended encapsulation of process isolation.
*
* @see http://fabien.potencier.org/article/9/php-serialization-stack-traces-and-exceptions
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class Exception extends \RuntimeException implements \PHPUnit\Exception
{
@@ -38,20 +40,17 @@ class Exception extends \RuntimeException implements \PHPUnit\Exception
*/
protected $serializableTrace;
public function __construct($message = '', $code = 0, \Exception $previous = null)
public function __construct($message = '', $code = 0, \Throwable $previous = null)
{
parent::__construct($message, $code, $previous);
$this->serializableTrace = $this->getTrace();
foreach ($this->serializableTrace as $i => $call) {
unset($this->serializableTrace[$i]['args']);
foreach (\array_keys($this->serializableTrace) as $key) {
unset($this->serializableTrace[$key]['args']);
}
}
/**
* @throws \InvalidArgumentException
*/
public function __toString(): string
{
$string = TestFailure::exceptionToString($this);
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -17,8 +17,10 @@ use SebastianBergmann\Comparator\ComparisonFailure;
* The exception contains the error message and optionally a
* SebastianBergmann\Comparator\ComparisonFailure which is used to
* generate diff output of the failed expectations.
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class ExpectationFailedException extends AssertionFailedError
final class ExpectationFailedException extends AssertionFailedError
{
/**
* @var ComparisonFailure
@@ -7,16 +7,11 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use PHPUnit\Framework\TestCase;
namespace PHPUnit\Framework;
/**
* @coversNothing
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class CoverageClassNothingTest extends TestCase
final class IncompleteTestError extends AssertionFailedError implements IncompleteTest
{
public function testSomething(): void
{
$o = new CoveredClass;
$o->publicMethod();
}
}
@@ -0,0 +1,37 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class InvalidArgumentException extends Exception
{
public static function create(int $argument, string $type): self
{
$stack = \debug_backtrace();
return new self(
\sprintf(
'Argument #%d of %s::%s() must be %s %s',
$argument,
$stack[1]['class'],
$stack[1]['function'],
\in_array(\lcfirst($type)[0], ['a', 'e', 'i', 'o', 'u'], true) ? 'an' : 'a',
$type
)
);
}
private function __construct(string $message = '', int $code = 0, \Exception $previous = null)
{
parent::__construct($message, $code, $previous);
}
}
@@ -7,18 +7,11 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework;
final class FinalClass
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class InvalidCoversTargetException extends CodeCoverageException
{
private $value;
public function __construct($value)
{
$this->value = $value;
}
public function value()
{
return $this->value;
}
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,6 +9,9 @@
*/
namespace PHPUnit\Framework;
class CoveredCodeNotExecutedException extends RiskyTestError
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class InvalidDataProviderException extends Exception
{
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,6 +9,9 @@
*/
namespace PHPUnit\Framework;
class MissingCoversAnnotationException extends RiskyTestError
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class MissingCoversAnnotationException extends RiskyTestError
{
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,6 +9,9 @@
*/
namespace PHPUnit\Framework;
class IncompleteTestError extends AssertionFailedError implements IncompleteTest
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class NoChildTestSuiteException extends Exception
{
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,6 +9,9 @@
*/
namespace PHPUnit\Framework;
class OutputError extends AssertionFailedError
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class OutputError extends AssertionFailedError
{
}
@@ -0,0 +1,32 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class PHPTAssertionFailedError extends SyntheticError
{
/**
* @var string
*/
private $diff;
public function __construct(string $message, int $code, string $file, int $line, array $trace, string $diff)
{
parent::__construct($message, $code, $file, $line, $trace);
$this->diff = $diff;
}
public function getDiff(): string
{
return $this->diff;
}
}
@@ -9,6 +9,9 @@
*/
namespace PHPUnit\Framework;
final class UnexpectedValueException extends Exception
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class RiskyTestError extends AssertionFailedError
{
}
@@ -0,0 +1,17 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class SkippedTestError extends AssertionFailedError implements SkippedTest
{
}
@@ -0,0 +1,17 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Framework;
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class SkippedTestSuiteError extends AssertionFailedError implements SkippedTest
{
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -10,7 +10,7 @@
namespace PHPUnit\Framework;
/**
* Creates a synthetic failed assertion.
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class SyntheticError extends AssertionFailedError
{
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -9,6 +9,9 @@
*/
namespace PHPUnit\Framework;
class SkippedTestSuiteError extends AssertionFailedError implements SkippedTest
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class SyntheticSkippedError extends SyntheticError implements SkippedTest
{
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -10,9 +10,8 @@
namespace PHPUnit\Framework;
/**
* Extension to PHPUnit\Framework\AssertionFailedError to mark the special
* case of a test that unintentionally covers code.
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class UnintentionallyCoveredCodeError extends RiskyTestError
final class UnintentionallyCoveredCodeError extends RiskyTestError
{
}
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -10,9 +10,9 @@
namespace PHPUnit\Framework;
/**
* Thrown when there is a warning.
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class Warning extends Exception implements SelfDescribing
final class Warning extends Exception implements SelfDescribing
{
/**
* Wrapper for getMessage() which is declared as final.
+7 -8
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -20,8 +20,10 @@ use Throwable;
*
* Unlike PHPUnit\Framework_\Exception, the complete stack of previous Exceptions
* is processed.
*
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class ExceptionWrapper extends Exception
final class ExceptionWrapper extends Exception
{
/**
* @var string
@@ -41,9 +43,6 @@ class ExceptionWrapper extends Exception
$this->setOriginalException($t);
}
/**
* @throws \InvalidArgumentException
*/
public function __toString(): string
{
$string = TestFailure::exceptionToString($this);
@@ -74,7 +73,7 @@ class ExceptionWrapper extends Exception
$this->className = $className;
}
public function setOriginalException(\Throwable $t): void
public function setOriginalException(Throwable $t): void
{
$this->originalException($t);
@@ -84,8 +83,8 @@ class ExceptionWrapper extends Exception
$this->serializableTrace = $t->getTrace();
foreach ($this->serializableTrace as $i => $call) {
unset($this->serializableTrace[$i]['args']);
foreach (\array_keys($this->serializableTrace) as $key) {
unset($this->serializableTrace[$key]['args']);
}
if ($t->getPrevious()) {
+2 -3
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -10,8 +10,7 @@
namespace PHPUnit\Framework;
/**
* A marker interface for marking any exception/error as result of an unit
* test as incomplete implementation or currently not implemented.
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
interface IncompleteTest
{
+5 -15
View File
@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
@@ -10,15 +10,10 @@
namespace PHPUnit\Framework;
/**
* An incomplete test case
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
class IncompleteTestCase extends TestCase
final class IncompleteTestCase extends TestCase
{
/**
* @var string
*/
protected $message = '';
/**
* @var bool
*/
@@ -35,14 +30,9 @@ class IncompleteTestCase extends TestCase
protected $runTestInSeparateProcess = false;
/**
* @var bool
* @var string
*/
protected $useErrorHandler = false;
/**
* @var bool
*/
protected $useOutputBuffering = false;
private $message;
public function __construct(string $className, string $methodName, string $message = '')
{

Some files were not shown because too many files have changed in this diff Show More