package updates
This commit is contained in:
3
vendor/phpunit/phpunit/.editorconfig
vendored
3
vendor/phpunit/phpunit/.editorconfig
vendored
@@ -6,3 +6,6 @@ insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
charset = utf-8
|
||||
|
||||
[tests/_files/*_result_cache.txt]
|
||||
insert_final_newline = false
|
||||
|
||||
10
vendor/phpunit/phpunit/.php_cs.dist
vendored
10
vendor/phpunit/phpunit/.php_cs.dist
vendored
@@ -156,7 +156,7 @@ return PhpCsFixer\Config::create()
|
||||
'phpdoc_to_comment' => true,
|
||||
'phpdoc_trim' => true,
|
||||
'phpdoc_trim_consecutive_blank_line_separation' => true,
|
||||
'phpdoc_types' => true,
|
||||
'phpdoc_types' => ['groups' => ['simple', 'meta']],
|
||||
'phpdoc_types_order' => true,
|
||||
'phpdoc_var_without_name' => true,
|
||||
'pow_to_exponentiation' => true,
|
||||
@@ -177,7 +177,13 @@ return PhpCsFixer\Config::create()
|
||||
'trailing_comma_in_multiline_array' => true,
|
||||
'trim_array_spaces' => true,
|
||||
'unary_operator_spaces' => true,
|
||||
'visibility_required' => true,
|
||||
'visibility_required' => [
|
||||
'elements' => [
|
||||
'const',
|
||||
'method',
|
||||
'property',
|
||||
],
|
||||
],
|
||||
//'void_return' => true,
|
||||
'whitespace_after_comma_in_array' => true,
|
||||
]
|
||||
|
||||
1
vendor/phpunit/phpunit/.travis.yml
vendored
1
vendor/phpunit/phpunit/.travis.yml
vendored
@@ -10,6 +10,7 @@ addons:
|
||||
php:
|
||||
- 7.1
|
||||
- 7.2
|
||||
- 7.3
|
||||
- master
|
||||
|
||||
matrix:
|
||||
|
||||
56
vendor/phpunit/phpunit/ChangeLog-7.0.md
vendored
56
vendor/phpunit/phpunit/ChangeLog-7.0.md
vendored
@@ -1,56 +0,0 @@
|
||||
# Changes in PHPUnit 7.0
|
||||
|
||||
All notable changes of the PHPUnit 7.0 release series are documented in this file using the [Keep a CHANGELOG](https://keepachangelog.com/) principles.
|
||||
|
||||
## [7.0.3] - 2018-03-26
|
||||
|
||||
* Fixed [#3028](https://github.com/sebastianbergmann/phpunit/pull/3028): TestDox name prettifier does not handle test case classes correctly that are in a `Tests\*` namespace
|
||||
|
||||
## [7.0.2] - 2018-02-26
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#2974](https://github.com/sebastianbergmann/phpunit/issues/2974): JUnit XML logfile contains invalid characters when test output contains binary data
|
||||
* Fixed [#3014](https://github.com/sebastianbergmann/phpunit/issues/3014): `TypeError` in `PHPUnit\Framework\TestCase::getActualOutput()` when callback registered using `setOutputCallback()` does not return a string
|
||||
* Removed more superfluous `@throws \Exception` annotations
|
||||
|
||||
## [7.0.1] - 2018-02-13
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3000](https://github.com/sebastianbergmann/phpunit/issues/3000): Directories are not created recursively
|
||||
* Removed superfluous `@throws \Exception` annotations from assertion methods
|
||||
|
||||
## [7.0.0] - 2018-02-02
|
||||
|
||||
### Added
|
||||
|
||||
* Implemented [#2967](https://github.com/sebastianbergmann/phpunit/pull/2967): Added support for PHP configuration settings to `@requires` annotation
|
||||
|
||||
### Changed
|
||||
|
||||
* Implemented [#2566](https://github.com/sebastianbergmann/phpunit/issues/2566): Use `Throwable` instead of `Exception` in `PHPUnit\Framework\TestListener` method signatures
|
||||
* Implemented [#2920](https://github.com/sebastianbergmann/phpunit/pull/2920): Replace CLI TestDox printer with `rpkamp/fancy-testdox-printer`
|
||||
* Scalar Type Declarations and Return Type Declarations are now used where possible (as a result, the API of `PHPUnit\Framework\TestListener`, for instance, has changed)
|
||||
* Some classes are now `final`
|
||||
* The visibility of some methods has been changed from `protected` to `private`
|
||||
|
||||
### Removed
|
||||
|
||||
* Implemented [#2473](https://github.com/sebastianbergmann/phpunit/issues/2473): Drop support for PHP 7.0
|
||||
* `@scenario` is no longer an alias for `@test`
|
||||
* The `PHPUnit\Framework\BaseTestListener` class has been removed (deprecated in PHPUnit 6.4)
|
||||
* The `PHPUnit\Framework\TestCase::prepareTemplate` template method has been removed
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#2169](https://github.com/sebastianbergmann/phpunit/issues/2169): `assertSame()` does not show differences when used on two arrays that are not identical
|
||||
* Fixed [#2902](https://github.com/sebastianbergmann/phpunit/issues/2902): `@test` annotation gets accepted no matter what
|
||||
* Fixed [#2907](https://github.com/sebastianbergmann/phpunit/issues/2907): `StringMatchesFormatDescription` constraint does not handle escaped `%` correctly
|
||||
* Fixed [#2919](https://github.com/sebastianbergmann/phpunit/issues/2919): `assertJsonStringEqualsJsonString()` matches empty object as empty array
|
||||
|
||||
[7.0.3]: https://github.com/sebastianbergmann/phpunit/compare/7.0.2...7.0.3
|
||||
[7.0.2]: https://github.com/sebastianbergmann/phpunit/compare/7.0.1...7.0.2
|
||||
[7.0.1]: https://github.com/sebastianbergmann/phpunit/compare/7.0.0...7.0.1
|
||||
[7.0.0]: https://github.com/sebastianbergmann/phpunit/compare/6.5...7.0.0
|
||||
|
||||
63
vendor/phpunit/phpunit/ChangeLog-7.1.md
vendored
63
vendor/phpunit/phpunit/ChangeLog-7.1.md
vendored
@@ -1,63 +0,0 @@
|
||||
# Changes in PHPUnit 7.1
|
||||
|
||||
All notable changes of the PHPUnit 7.1 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [7.1.6] - 2018-MM-DD
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3107](https://github.com/sebastianbergmann/phpunit/issues/3107): `CliTestDoxPrinter::addError()` cannot handle errors in `setUpBeforeClass()`
|
||||
* Fixed [#3142](https://github.com/sebastianbergmann/phpunit/issues/3142): Method-level annotations (`@backupGlobals`, `@backupStaticAttributes`, `@errorHandler`, `@preserveGlobalState`) do not override class-level annotations
|
||||
|
||||
## [7.1.5] - 2018-04-29
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3105](https://github.com/sebastianbergmann/phpunit/pull/3105): Name is prettified inconsistently when snake_case notation is used
|
||||
|
||||
## [7.1.4] - 2018-04-18
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3034](https://github.com/sebastianbergmann/phpunit/pull/3034): `$this->getStatus()` returns `STATUS_PASSED` in `tearDown()` after unexpected exception
|
||||
|
||||
## [7.1.3] - 2018-04-13
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3094](https://github.com/sebastianbergmann/phpunit/issues/3094): Faulty dependency constraint affecting `getObjectForTrait()` (failure using `--prefer-lowest`)
|
||||
|
||||
## [7.1.2] - 2018-04-10
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#2830](https://github.com/sebastianbergmann/phpunit/issues/2830): `@runClassInSeparateProcess` does not work for tests that use `@dataProvider`
|
||||
* Fixed [#3059](https://github.com/sebastianbergmann/phpunit/pull/3059): `StringMatchesFormatDescription` constraint fails when matching multiline with `\r\n`
|
||||
* Fixed [#3087](https://github.com/sebastianbergmann/phpunit/pull/3087): `TestCase::getTestResultObject()` can return `null`
|
||||
|
||||
## [7.1.1] - 2018-04-06
|
||||
|
||||
### Fixed
|
||||
|
||||
* `CliTestDoxPrinter::writeProgress()` and `TeamCity::writeProgress()` are not compatible with `ResultPrinter::writeProgress()` (on PHP 7.1)
|
||||
|
||||
## [7.1.0] - 2018-04-06
|
||||
|
||||
### Added
|
||||
|
||||
* Implemented [#3002](https://github.com/sebastianbergmann/phpunit/issues/3002): Support for test runner extensions
|
||||
* Implemented [#3035](https://github.com/sebastianbergmann/phpunit/pull/3035): Add support for `iterable` in `assertInternalType()`
|
||||
|
||||
### Changed
|
||||
|
||||
* `PHPUnit\Framework\Assert` is no longer searched for test methods
|
||||
* `ReflectionMethod::invokeArgs()` is no longer used to invoke test methods
|
||||
|
||||
[7.1.6]: https://github.com/sebastianbergmann/phpunit/compare/7.1.5...7.1.6
|
||||
[7.1.5]: https://github.com/sebastianbergmann/phpunit/compare/7.1.4...7.1.5
|
||||
[7.1.4]: https://github.com/sebastianbergmann/phpunit/compare/7.1.3...7.1.4
|
||||
[7.1.3]: https://github.com/sebastianbergmann/phpunit/compare/7.1.2...7.1.3
|
||||
[7.1.2]: https://github.com/sebastianbergmann/phpunit/compare/7.1.1...7.1.2
|
||||
[7.1.1]: https://github.com/sebastianbergmann/phpunit/compare/7.1.0...7.1.1
|
||||
[7.1.0]: https://github.com/sebastianbergmann/phpunit/compare/7.0...7.1.0
|
||||
|
||||
78
vendor/phpunit/phpunit/ChangeLog-7.2.md
vendored
78
vendor/phpunit/phpunit/ChangeLog-7.2.md
vendored
@@ -1,78 +0,0 @@
|
||||
# Changes in PHPUnit 7.2
|
||||
|
||||
All notable changes of the PHPUnit 7.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [7.2.7] - 2018-07-15
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3154](https://github.com/sebastianbergmann/phpunit/issues/3154): Global constants as default parameter values are not handled correctly in namespace
|
||||
* Fixed [#3189](https://github.com/sebastianbergmann/phpunit/issues/3189): PHPUnit 7.2 potentially leaves a messy libxmlerror state
|
||||
* Fixed [#3199](https://github.com/sebastianbergmann/phpunit/pull/3199): Code Coverage for PHPT tests does not work when PHPDBG is used
|
||||
|
||||
## [7.2.6] - 2018-06-21
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3176](https://github.com/sebastianbergmann/phpunit/issues/3176): PHPUnit 7.2.5 breaks backward compatibility
|
||||
|
||||
## [7.2.5] - 2018-06-21
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3093](https://github.com/sebastianbergmann/phpunit/issues/3093): Unable to chain a `@dataProvider` in method `a` with a `@depends` in method `b`
|
||||
* Fixed [#3174](https://github.com/sebastianbergmann/phpunit/issues/3174): Code generator for test doubles does not handle proxied methods with variadic parameters correctly
|
||||
|
||||
## [7.2.4] - 2018-06-05
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3160](https://github.com/sebastianbergmann/phpunit/issues/3160): TeamCity logfile writer broken on Windows
|
||||
|
||||
## [7.2.3] - 2018-06-03
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3156](https://github.com/sebastianbergmann/phpunit/issues/3156): Combined use of `@depends` and `@dataProvider` is not handled correctly
|
||||
|
||||
## [7.2.2] - 2018-06-01
|
||||
|
||||
### Changed
|
||||
|
||||
* Ensure that `phpunit/php-code-coverage` is used in version `^6.0.7`
|
||||
|
||||
## [7.2.1] - 2018-06-01
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3155](https://github.com/sebastianbergmann/phpunit/issues/3155): Calling `getStatus()` on a `TestCase` object before the respective test has been executed results in type error
|
||||
|
||||
## [7.2.0] - 2018-06-01
|
||||
|
||||
### Added
|
||||
|
||||
* Implemented [#3042](https://github.com/sebastianbergmann/phpunit/pull/3042): Add `TestCase::expectNotToPerformAssertions()` method as alternative to `@doesNotPerformAssertions` annotation
|
||||
* Implemented [#3064](https://github.com/sebastianbergmann/phpunit/issues/3064): Mark tests as risky when they claim not to perform assertions but do
|
||||
* Implemented [#3066](https://github.com/sebastianbergmann/phpunit/issues/3066): Validate XML configuration against XSD
|
||||
* Implemented [#3076](https://github.com/sebastianbergmann/phpunit/issues/3076): Extensions can be configured via PHPUnit's XML configuration
|
||||
* Implemented [#3080](https://github.com/sebastianbergmann/phpunit/issues/3080): The XML configuration arguments can have boolean elements
|
||||
* Implemented [#3092](https://github.com/sebastianbergmann/phpunit/pull/3092): Ability to run tests in random order, reverse order, ordered using dependency resolution
|
||||
|
||||
### Changed
|
||||
|
||||
* Implemented [#3103](https://github.com/sebastianbergmann/phpunit/issues/3103): Merge `phpunit-mock-objects` back into PHPUnit's Git repository
|
||||
* Implemented [#3115](https://github.com/sebastianbergmann/phpunit/pull/3115): Method-level `@covers` annotation overrides class-level `@coversNothing` annotation
|
||||
|
||||
### Removed
|
||||
|
||||
* Fixed [#3069](https://github.com/sebastianbergmann/phpunit/issues/3069): Method `ResultPrinter::printWaitPrompt()` seems to be unused
|
||||
|
||||
[7.2.7]: https://github.com/sebastianbergmann/phpunit/compare/7.2.6...7.2.7
|
||||
[7.2.6]: https://github.com/sebastianbergmann/phpunit/compare/7.2.5...7.2.6
|
||||
[7.2.5]: https://github.com/sebastianbergmann/phpunit/compare/7.2.4...7.2.5
|
||||
[7.2.4]: https://github.com/sebastianbergmann/phpunit/compare/7.2.3...7.2.4
|
||||
[7.2.3]: https://github.com/sebastianbergmann/phpunit/compare/7.2.2...7.2.3
|
||||
[7.2.2]: https://github.com/sebastianbergmann/phpunit/compare/7.2.1...7.2.2
|
||||
[7.2.1]: https://github.com/sebastianbergmann/phpunit/compare/7.2.0...7.2.1
|
||||
[7.2.0]: https://github.com/sebastianbergmann/phpunit/compare/7.1...7.2.0
|
||||
|
||||
82
vendor/phpunit/phpunit/ChangeLog-7.3.md
vendored
82
vendor/phpunit/phpunit/ChangeLog-7.3.md
vendored
@@ -1,82 +0,0 @@
|
||||
# Changes in PHPUnit 7.3
|
||||
|
||||
All notable changes of the PHPUnit 7.3 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [7.3.6] - 2018-MM-DD
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3310](https://github.com/sebastianbergmann/phpunit/issues/3310): Inconsistent `@throws` annotations in `Assert/Functions.php`
|
||||
|
||||
## [7.3.5] - 2018-09-08
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3181](https://github.com/sebastianbergmann/phpunit/issues/3181): `--filter` should be case-insensitive
|
||||
* Fixed [#3234](https://github.com/sebastianbergmann/phpunit/issues/3234): `assertArraySubset()` with `$strict=true` does not display differences properly
|
||||
* Fixed [#3254](https://github.com/sebastianbergmann/phpunit/issues/3254): TextUI test runner cannot run a `Test` instance that is not a `TestSuite`
|
||||
|
||||
## [7.3.4] - 2018-09-05
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3270](https://github.com/sebastianbergmann/phpunit/issues/3270): Array / Object to string conversion in `NamePrettifier`
|
||||
|
||||
## [7.3.3] - 2018-09-01
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3265](https://github.com/sebastianbergmann/phpunit/pull/3265): Slashes are unnecessarily escaped in prettified JSON
|
||||
* Fixed [#3267](https://github.com/sebastianbergmann/phpunit/pull/3267): `%` not escaped correctly for `StringMatchesFormat` constraint
|
||||
|
||||
## [7.3.2] - 2018-08-22
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3219](https://github.com/sebastianbergmann/phpunit/issues/3219): `getMockFromWsdl()` generates invalid PHP code when WSDL filename contains special characters
|
||||
* Fixed [#3248](https://github.com/sebastianbergmann/phpunit/issues/3248) and [#3233](https://github.com/sebastianbergmann/phpunit/issues/3233): `phpunit.xsd` dictates element order where it should not
|
||||
* Fixed [#3251](https://github.com/sebastianbergmann/phpunit/issues/3251): TeamCity result logger is missing test duration information
|
||||
|
||||
## [7.3.1] - 2018-08-07
|
||||
|
||||
### Changed
|
||||
|
||||
* Reverted [#3161](https://github.com/sebastianbergmann/phpunit/pull/3161) (because of [#3240](https://github.com/sebastianbergmann/phpunit/issues/3240)): Support for indexed arrays in `PHPUnit\Framework\Constraint\ArraySubset`
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3237](https://github.com/sebastianbergmann/phpunit/issues/3237): Result caching enabled by default
|
||||
* Fixed [#3240](https://github.com/sebastianbergmann/phpunit/issues/3240): `assertArraySubset()` does not work as expected
|
||||
|
||||
## [7.3.0] - 2018-08-03
|
||||
|
||||
### Added
|
||||
|
||||
* Implemented [#3147](https://github.com/sebastianbergmann/phpunit/pull/3147): Support for running tests first that failed in a previous run
|
||||
* Implemented `cacheResult` configuration directive and `--cache-result` CLI option to control test result cache required for "run defects first" functionality (disabled by default)
|
||||
* Implemented `cacheResultFile` configuration directive and `--cache-result-file` CLI option to configure test result cache file (default: `.phpunit.result.cache`)
|
||||
* Implemented `stopOnDefect` configuration directive and `--stop-on-defect` CLI option for aborting test suite execution upon first defective test
|
||||
* Implemented `executionOrder` configuration directive and `--order-by` CLI option for sorting the test suite before execution
|
||||
* The `--order-by=random` CLI option should now be used instead of `--random-order`
|
||||
* The `--order-by=depends` CLI option should now be used instead of `--resolve-dependencies`
|
||||
* The `--order-by=reverse` CLI option should now be used instead of `--reverse-order`
|
||||
* Implemented [#3161](https://github.com/sebastianbergmann/phpunit/pull/3161): Support for indexed arrays in `PHPUnit\Framework\Constraint\ArraySubset`
|
||||
* Implemented [#3194](https://github.com/sebastianbergmann/phpunit/issues/3194): `@covers class` (and `@uses class`) should include traits used by class
|
||||
* Implemented [#3196](https://github.com/sebastianbergmann/phpunit/issues/3196): Support for replacing placeholders in `@testdox` text with data provider values
|
||||
* Implemented [#3198](https://github.com/sebastianbergmann/phpunit/pull/3198): Provide source location for useless tests
|
||||
|
||||
### Fixed
|
||||
|
||||
* Fixed [#3154](https://github.com/sebastianbergmann/phpunit/issues/3154): Global constants as default parameter values are not handled correctly in namespace
|
||||
* Fixed [#3218](https://github.com/sebastianbergmann/phpunit/issues/3218): `prefix` attribute for `directory` node missing from `phpunit.xml` XSD
|
||||
* Fixed [#3222](https://github.com/sebastianbergmann/phpunit/pull/3222): Priority of `@covers` and `@coversNothing` is wrong
|
||||
* Fixed [#3225](https://github.com/sebastianbergmann/phpunit/issues/3225): `coverage-php` missing from `phpunit.xsd`
|
||||
|
||||
[7.3.6]: https://github.com/sebastianbergmann/phpunit/compare/7.3.5...7.3.6
|
||||
[7.3.5]: https://github.com/sebastianbergmann/phpunit/compare/7.3.4...7.3.5
|
||||
[7.3.4]: https://github.com/sebastianbergmann/phpunit/compare/7.3.3...7.3.4
|
||||
[7.3.3]: https://github.com/sebastianbergmann/phpunit/compare/7.3.2...7.3.3
|
||||
[7.3.2]: https://github.com/sebastianbergmann/phpunit/compare/7.3.1...7.3.2
|
||||
[7.3.1]: https://github.com/sebastianbergmann/phpunit/compare/7.3.0...7.3.1
|
||||
[7.3.0]: https://github.com/sebastianbergmann/phpunit/compare/7.2...7.3.0
|
||||
|
||||
16
vendor/phpunit/phpunit/ChangeLog-7.4.md
vendored
16
vendor/phpunit/phpunit/ChangeLog-7.4.md
vendored
@@ -1,16 +0,0 @@
|
||||
# Changes in PHPUnit 7.4
|
||||
|
||||
All notable changes of the PHPUnit 7.4 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
|
||||
|
||||
## [7.4.0] - 2018-10-05
|
||||
|
||||
### Added
|
||||
|
||||
* Implemented [#3127](https://github.com/sebastianbergmann/phpunit/issues/3127): Emit error when mocked method is not really mocked
|
||||
* Implemented [#3224](https://github.com/sebastianbergmann/phpunit/pulls/3224): Ability to enforce a time limit for tests not annotated with `@small`, `@medium`, or `@large`
|
||||
* Implemented [#3272](https://github.com/sebastianbergmann/phpunit/issues/3272): Ability to generate code coverage whitelist filter script for Xdebug
|
||||
* Implemented [#3284](https://github.com/sebastianbergmann/phpunit/issues/3284): Ability to reorder tests based on execution time
|
||||
* Implemented [#3290](https://github.com/sebastianbergmann/phpunit/issues/3290): Ability to load a PHP script before any code of PHPUnit itself is loaded
|
||||
|
||||
[7.4.0]: https://github.com/sebastianbergmann/phpunit/compare/7.3...7.4.0
|
||||
|
||||
38
vendor/phpunit/phpunit/ChangeLog-7.5.md
vendored
Normal file
38
vendor/phpunit/phpunit/ChangeLog-7.5.md
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
# 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](http://keepachangelog.com/) principles.
|
||||
|
||||
## [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.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
|
||||
|
||||
8
vendor/phpunit/phpunit/README.md
vendored
8
vendor/phpunit/phpunit/README.md
vendored
@@ -4,16 +4,16 @@ PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of
|
||||
|
||||
[](https://packagist.org/packages/phpunit/phpunit)
|
||||
[](https://php.net/)
|
||||
[](https://phpunit.de/build-status.html)
|
||||
[](https://phpunit.de/build-status.html)
|
||||
|
||||
## Installation
|
||||
|
||||
We distribute a [PHP Archive (PHAR)](https://php.net/phar) that has all required (as well as some optional) dependencies of PHPUnit 7.4 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 7.5 bundled in a single file:
|
||||
|
||||
```bash
|
||||
$ wget https://phar.phpunit.de/phpunit-7.4.phar
|
||||
$ wget https://phar.phpunit.de/phpunit-7.5.phar
|
||||
|
||||
$ php phpunit-7.4.phar --version
|
||||
$ php phpunit-7.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.
|
||||
|
||||
13
vendor/phpunit/phpunit/build.xml
vendored
13
vendor/phpunit/phpunit/build.xml
vendored
@@ -60,6 +60,17 @@
|
||||
<move file="${basedir}/composer.json.bak" tofile="${basedir}/composer.json"/>
|
||||
</target>
|
||||
|
||||
<target name="check-dependencies" description="Performs check for outdated dependencies">
|
||||
<exec executable="${basedir}/build/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"/>
|
||||
@@ -109,7 +120,7 @@
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
<target name="phar" depends="-phar-determine-version,-phar-prepare" description="Create PHAR archive of PHPUnit and all its dependencies">
|
||||
<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>
|
||||
|
||||
4
vendor/phpunit/phpunit/composer.json
vendored
4
vendor/phpunit/phpunit/composer.json
vendored
@@ -38,7 +38,7 @@
|
||||
"phpunit/php-timer": "^2.0",
|
||||
"sebastian/comparator": "^3.0",
|
||||
"sebastian/diff": "^3.0",
|
||||
"sebastian/environment": "^3.1",
|
||||
"sebastian/environment": "^4.0",
|
||||
"sebastian/exporter": "^3.1",
|
||||
"sebastian/global-state": "^2.0",
|
||||
"sebastian/object-enumerator": "^3.0.3",
|
||||
@@ -84,7 +84,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "7.4-dev"
|
||||
"dev-master": "7.5-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
vendor/phpunit/phpunit/phive.xml
vendored
4
vendor/phpunit/phpunit/phive.xml
vendored
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phive xmlns="https://phar.io/phive">
|
||||
<phar name="phpab" version="^1.24.1" installed="1.25.0" location="./build/tools/phpab" copy="true"/>
|
||||
<phar name="php-cs-fixer" version="^2.12.0" installed="2.13.0" location="./build/tools/php-cs-fixer" copy="true"/>
|
||||
<phar name="phpab" version="^1.24.1" installed="1.25.1" location="./build/tools/phpab" copy="true"/>
|
||||
<phar name="php-cs-fixer" version="^2.12.0" installed="2.13.1" location="./build/tools/php-cs-fixer" copy="true"/>
|
||||
<phar name="phpdox" version="^0.11.2" installed="0.11.2" location="./build/tools/phpdox" copy="true"/>
|
||||
<phar name="phploc" version="^4.0.1" installed="4.0.1" location="./build/tools/phploc" copy="true"/>
|
||||
</phive>
|
||||
|
||||
2
vendor/phpunit/phpunit/phpunit.xsd
vendored
2
vendor/phpunit/phpunit/phpunit.xsd
vendored
@@ -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.4 may be structured.
|
||||
This Schema file defines the rules by which the XML configuration file of PHPUnit 7.5 may be structured.
|
||||
</xs:documentation>
|
||||
<xs:appinfo source="https://phpunit.de/documentation.html"/>
|
||||
</xs:annotation>
|
||||
|
||||
473
vendor/phpunit/phpunit/src/Framework/Assert.php
vendored
473
vendor/phpunit/phpunit/src/Framework/Assert.php
vendored
@@ -209,6 +209,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeContains($needle, string $haystackAttributeName, $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void
|
||||
{
|
||||
@@ -271,6 +273,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeNotContains($needle, string $haystackAttributeName, $haystackClassOrObject, string $message = '', bool $ignoreCase = false, bool $checkForObjectIdentity = true, bool $checkForNonObjectIdentity = false): void
|
||||
{
|
||||
@@ -333,6 +337,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeContainsOnly(string $type, string $haystackAttributeName, $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void
|
||||
{
|
||||
@@ -378,6 +384,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeNotContainsOnly(string $type, string $haystackAttributeName, $haystackClassOrObject, ?bool $isNativeType = null, string $message = ''): void
|
||||
{
|
||||
@@ -418,6 +426,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeCount(int $expectedCount, string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -457,6 +467,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeNotCount(int $expectedCount, string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -486,6 +498,60 @@ abstract class Assert
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two variables are equal (canonicalizing).
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public static function assertEqualsCanonicalizing($expected, $actual, string $message = ''): void
|
||||
{
|
||||
$constraint = new IsEqual(
|
||||
$expected,
|
||||
0.0,
|
||||
10,
|
||||
true,
|
||||
false
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two variables are equal (ignoring case).
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public static function assertEqualsIgnoringCase($expected, $actual, string $message = ''): void
|
||||
{
|
||||
$constraint = new IsEqual(
|
||||
$expected,
|
||||
0.0,
|
||||
10,
|
||||
false,
|
||||
true
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two variables are equal (with delta).
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public static function assertEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void
|
||||
{
|
||||
$constraint = new IsEqual(
|
||||
$expected,
|
||||
$delta
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is equal to an attribute of an object.
|
||||
*
|
||||
@@ -493,6 +559,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
|
||||
{
|
||||
@@ -533,6 +601,66 @@ abstract class Assert
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two variables are not equal (canonicalizing).
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public static function assertNotEqualsCanonicalizing($expected, $actual, string $message = ''): void
|
||||
{
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqual(
|
||||
$expected,
|
||||
0.0,
|
||||
10,
|
||||
true,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two variables are not equal (ignoring case).
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public static function assertNotEqualsIgnoringCase($expected, $actual, string $message = ''): void
|
||||
{
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqual(
|
||||
$expected,
|
||||
0.0,
|
||||
10,
|
||||
false,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that two variables are not equal (with delta).
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*/
|
||||
public static function assertNotEqualsWithDelta($expected, $actual, float $delta, string $message = ''): void
|
||||
{
|
||||
$constraint = new LogicalNot(
|
||||
new IsEqual(
|
||||
$expected,
|
||||
$delta
|
||||
)
|
||||
);
|
||||
|
||||
static::assertThat($actual, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not equal to an attribute of an object.
|
||||
*
|
||||
@@ -540,6 +668,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeNotEquals($expected, string $actualAttributeName, $actualClassOrObject, string $message = '', float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): void
|
||||
{
|
||||
@@ -573,6 +703,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -601,6 +733,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeNotEmpty(string $haystackAttributeName, $haystackClassOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -628,6 +762,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeGreaterThan($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -660,6 +796,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeGreaterThanOrEqual($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -688,6 +826,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeLessThan($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -716,6 +856,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeLessThanOrEqual($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -1269,6 +1411,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeSame($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -1310,6 +1454,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeNotSame($expected, string $actualAttributeName, $actualClassOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -1346,6 +1492,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeInstanceOf(string $expected, string $attributeName, $classOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -1384,6 +1532,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeNotInstanceOf(string $expected, string $attributeName, $classOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -1399,6 +1549,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3369
|
||||
*/
|
||||
public static function assertInternalType(string $expected, $actual, string $message = ''): void
|
||||
{
|
||||
@@ -1416,6 +1568,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeInternalType(string $expected, string $attributeName, $classOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -1426,11 +1580,145 @@ abstract class Assert
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type array.
|
||||
*/
|
||||
public static function assertIsArray($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_ARRAY),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type bool.
|
||||
*/
|
||||
public static function assertIsBool($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_BOOL),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type float.
|
||||
*/
|
||||
public static function assertIsFloat($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_FLOAT),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type int.
|
||||
*/
|
||||
public static function assertIsInt($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_INT),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type numeric.
|
||||
*/
|
||||
public static function assertIsNumeric($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_NUMERIC),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type object.
|
||||
*/
|
||||
public static function assertIsObject($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_OBJECT),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type resource.
|
||||
*/
|
||||
public static function assertIsResource($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_RESOURCE),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type string.
|
||||
*/
|
||||
public static function assertIsString($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_STRING),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type scalar.
|
||||
*/
|
||||
public static function assertIsScalar($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_SCALAR),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type callable.
|
||||
*/
|
||||
public static function assertIsCallable($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_CALLABLE),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is of type iterable.
|
||||
*/
|
||||
public static function assertIsIterable($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new IsType(IsType::TYPE_ITERABLE),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of a given type.
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3369
|
||||
*/
|
||||
public static function assertNotInternalType(string $expected, $actual, string $message = ''): void
|
||||
{
|
||||
@@ -1443,6 +1731,138 @@ abstract class Assert
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type array.
|
||||
*/
|
||||
public static function assertIsNotArray($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_ARRAY)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type bool.
|
||||
*/
|
||||
public static function assertIsNotBool($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_BOOL)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type float.
|
||||
*/
|
||||
public static function assertIsNotFloat($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_FLOAT)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type int.
|
||||
*/
|
||||
public static function assertIsNotInt($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_INT)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type numeric.
|
||||
*/
|
||||
public static function assertIsNotNumeric($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_NUMERIC)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type object.
|
||||
*/
|
||||
public static function assertIsNotObject($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_OBJECT)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type resource.
|
||||
*/
|
||||
public static function assertIsNotResource($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_RESOURCE)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type string.
|
||||
*/
|
||||
public static function assertIsNotString($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_STRING)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type scalar.
|
||||
*/
|
||||
public static function assertIsNotScalar($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_SCALAR)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type callable.
|
||||
*/
|
||||
public static function assertIsNotCallable($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_CALLABLE)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a variable is not of type iterable.
|
||||
*/
|
||||
public static function assertIsNotIterable($actual, string $message = ''): void
|
||||
{
|
||||
static::assertThat(
|
||||
$actual,
|
||||
new LogicalNot(new IsType(IsType::TYPE_ITERABLE)),
|
||||
$message
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that an attribute is of a given type.
|
||||
*
|
||||
@@ -1450,6 +1870,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws ExpectationFailedException
|
||||
* @throws \SebastianBergmann\RecursionContext\InvalidArgumentException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function assertAttributeNotInternalType(string $expected, string $attributeName, $classOrObject, string $message = ''): void
|
||||
{
|
||||
@@ -1643,6 +2065,34 @@ abstract class Assert
|
||||
);
|
||||
}
|
||||
|
||||
public static function assertStringContainsString(string $needle, string $haystack, string $message = ''): void
|
||||
{
|
||||
$constraint = new StringContains($needle, false);
|
||||
|
||||
static::assertThat($haystack, $constraint, $message);
|
||||
}
|
||||
|
||||
public static function assertStringContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void
|
||||
{
|
||||
$constraint = new StringContains($needle, true);
|
||||
|
||||
static::assertThat($haystack, $constraint, $message);
|
||||
}
|
||||
|
||||
public static function assertStringNotContainsString(string $needle, string $haystack, string $message = ''): void
|
||||
{
|
||||
$constraint = new LogicalNot(new StringContains($needle));
|
||||
|
||||
static::assertThat($haystack, $constraint, $message);
|
||||
}
|
||||
|
||||
public static function assertStringNotContainsStringIgnoringCase(string $needle, string $haystack, string $message = ''): void
|
||||
{
|
||||
$constraint = new LogicalNot(new StringContains($needle, true));
|
||||
|
||||
static::assertThat($haystack, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that a string ends with a given suffix.
|
||||
*
|
||||
@@ -2077,6 +2527,9 @@ abstract class Assert
|
||||
return new IsNan;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function attribute(Constraint $constraint, string $attributeName): Attribute
|
||||
{
|
||||
return new Attribute($constraint, $attributeName);
|
||||
@@ -2110,6 +2563,9 @@ abstract class Assert
|
||||
return new IsEqual($value, $delta, $maxDepth, $canonicalize, $ignoreCase);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function attributeEqualTo(string $attributeName, $value, float $delta = 0.0, int $maxDepth = 10, bool $canonicalize = false, bool $ignoreCase = false): Attribute
|
||||
{
|
||||
return static::attribute(
|
||||
@@ -2254,6 +2710,8 @@ abstract class Assert
|
||||
* @param object|string $classOrObject
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function readAttribute($classOrObject, string $attributeName)
|
||||
{
|
||||
@@ -2294,6 +2752,8 @@ abstract class Assert
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws ReflectionException
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function getStaticAttribute(string $className, string $attributeName)
|
||||
{
|
||||
@@ -2332,6 +2792,8 @@ abstract class Assert
|
||||
* @param object $object
|
||||
*
|
||||
* @throws Exception
|
||||
*
|
||||
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/3338
|
||||
*/
|
||||
public static function getObjectAttribute($object, string $attributeName)
|
||||
{
|
||||
@@ -2413,4 +2875,15 @@ abstract class Assert
|
||||
{
|
||||
return \preg_match('/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/', $attributeName);
|
||||
}
|
||||
|
||||
private static function createWarning(string $warning): void
|
||||
{
|
||||
foreach (\debug_backtrace() as $step) {
|
||||
if (isset($step['object']) && $step['object'] instanceof TestCase) {
|
||||
$step['object']->addWarning($warning);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ class IsEqual extends Constraint
|
||||
}
|
||||
|
||||
return \sprintf(
|
||||
'is equal to "%s"',
|
||||
"is equal to '%s'",
|
||||
$this->value
|
||||
);
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ class Generator
|
||||
$cloneTemplate = $cloneTemplate->render();
|
||||
}
|
||||
|
||||
if (\is_array($explicitMethods) && empty($explicitMethods) &&
|
||||
if ($explicitMethods === [] &&
|
||||
($isClass || $isInterface)) {
|
||||
$mockMethods->addMethods(
|
||||
...$this->mockClassMethods($mockClassName['fullClassName'], $callOriginalMethods, $cloneArguments)
|
||||
|
||||
@@ -17,6 +17,8 @@ use PHPUnit\Framework\MockObject\Matcher\Invocation;
|
||||
* MockBuilder.
|
||||
*
|
||||
* @method InvocationMocker method($constraint)
|
||||
*
|
||||
* @deprecated Use PHPUnit\Framework\MockObject\MockObject instead
|
||||
*/
|
||||
interface PHPUnit_Framework_MockObject_MockObject /*extends Verifiable*/
|
||||
{
|
||||
|
||||
@@ -686,11 +686,9 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
return $result;
|
||||
}
|
||||
|
||||
$runEntireClass = $this->runClassInSeparateProcess && !$this->runTestInSeparateProcess;
|
||||
if ($this->runInSeparateProcess()) {
|
||||
$runEntireClass = $this->runClassInSeparateProcess && !$this->runTestInSeparateProcess;
|
||||
|
||||
if (($this->runTestInSeparateProcess === true || $this->runClassInSeparateProcess === true) &&
|
||||
$this->inIsolation !== true &&
|
||||
!$this instanceof PhptTestCase) {
|
||||
$class = new ReflectionClass($this);
|
||||
|
||||
if ($runEntireClass) {
|
||||
@@ -1125,6 +1123,11 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
public function addWarning(string $warning): void
|
||||
{
|
||||
$this->warnings[] = $warning;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to run the test and assert its state.
|
||||
*
|
||||
@@ -1720,7 +1723,10 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
}
|
||||
|
||||
if (!isset($passedKeys[$dependency])) {
|
||||
$this->status = BaseTestRunner::STATUS_SKIPPED;
|
||||
|
||||
$this->result->startTest($this);
|
||||
|
||||
$this->result->addError(
|
||||
$this,
|
||||
new SkippedTestError(
|
||||
@@ -1731,6 +1737,7 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
),
|
||||
0
|
||||
);
|
||||
|
||||
$this->result->endTest($this, 0);
|
||||
|
||||
return false;
|
||||
@@ -1985,13 +1992,7 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach ($enumerator->enumerate($this->testResult) as $object) {
|
||||
if ($mock === $object) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return !\in_array($mock, $enumerator->enumerate($this->testResult), true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2110,4 +2111,10 @@ abstract class TestCase extends Assert implements Test, SelfDescribing
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function runInSeparateProcess(): bool
|
||||
{
|
||||
return ($this->runTestInSeparateProcess === true || $this->runClassInSeparateProcess === true) &&
|
||||
$this->inIsolation !== true && !$this instanceof PhptTestCase;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,12 +704,10 @@ class TestSuite implements Test, SelfDescribing, IteratorAggregate
|
||||
}
|
||||
}
|
||||
} catch (SkippedTestSuiteError $e) {
|
||||
$numTests = \count($this);
|
||||
|
||||
for ($i = 0; $i < $numTests; $i++) {
|
||||
$result->startTest($this);
|
||||
$result->addFailure($this, $e, 0);
|
||||
$result->endTest($this, 0);
|
||||
foreach ($this->tests() as $test) {
|
||||
$result->startTest($test);
|
||||
$result->addFailure($test, $e, 0);
|
||||
$result->endTest($test, 0);
|
||||
}
|
||||
|
||||
$this->tearDown();
|
||||
@@ -717,16 +715,14 @@ class TestSuite implements Test, SelfDescribing, IteratorAggregate
|
||||
|
||||
return $result;
|
||||
} catch (Throwable $t) {
|
||||
$numTests = \count($this);
|
||||
|
||||
for ($i = 0; $i < $numTests; $i++) {
|
||||
foreach ($this->tests() as $test) {
|
||||
if ($result->shouldStop()) {
|
||||
break;
|
||||
}
|
||||
|
||||
$result->startTest($this);
|
||||
$result->addError($this, $t, 0);
|
||||
$result->endTest($this, 0);
|
||||
$result->startTest($test);
|
||||
$result->addError($test, $t, 0);
|
||||
$result->endTest($test, 0);
|
||||
}
|
||||
|
||||
$this->tearDown();
|
||||
|
||||
21
vendor/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php
vendored
Normal file
21
vendor/phpunit/phpunit/src/Runner/Hook/AfterTestHook.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?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\Runner;
|
||||
|
||||
interface AfterTestHook extends Hook
|
||||
{
|
||||
/**
|
||||
* This hook will fire after any test, regardless of the result.
|
||||
*
|
||||
* For more fine grained control, have a look at the other hooks
|
||||
* that extend PHPUnit\Runner\Hook.
|
||||
*/
|
||||
public function executeAfterTest(string $test, float $time): void;
|
||||
}
|
||||
@@ -112,13 +112,17 @@ final class TestListenerAdapter implements TestListener
|
||||
|
||||
public function endTest(Test $test, float $time): void
|
||||
{
|
||||
if ($this->lastTestWasNotSuccessful === true) {
|
||||
return;
|
||||
if ($this->lastTestWasNotSuccessful !== true) {
|
||||
foreach ($this->hooks as $hook) {
|
||||
if ($hook instanceof AfterSuccessfulTestHook) {
|
||||
$hook->executeAfterSuccessfulTest(TestUtil::describeAsString($test), $time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->hooks as $hook) {
|
||||
if ($hook instanceof AfterSuccessfulTestHook) {
|
||||
$hook->executeAfterSuccessfulTest(TestUtil::describeAsString($test), $time);
|
||||
if ($hook instanceof AfterTestHook) {
|
||||
$hook->executeAfterTest(TestUtil::describeAsString($test), $time);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,11 @@ class PhptTestCase implements Test, SelfDescribing
|
||||
*/
|
||||
private $phpUtil;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
private $output = '';
|
||||
|
||||
/**
|
||||
* Constructs a test case with the given filename.
|
||||
*
|
||||
@@ -155,8 +160,9 @@ class PhptTestCase implements Test, SelfDescribing
|
||||
|
||||
Timer::start();
|
||||
|
||||
$jobResult = $this->phpUtil->runJob($code, $this->stringifyIni($settings));
|
||||
$time = Timer::stop();
|
||||
$jobResult = $this->phpUtil->runJob($code, $this->stringifyIni($settings));
|
||||
$time = Timer::stop();
|
||||
$this->output = $jobResult['stdout'] ?? '';
|
||||
|
||||
if ($result->getCollectCodeCoverageInformation() && ($coverage = $this->cleanupForCoverage())) {
|
||||
$result->getCodeCoverage()->append($coverage, $this, true, [], [], true);
|
||||
@@ -202,6 +208,26 @@ class PhptTestCase implements Test, SelfDescribing
|
||||
return $this->filename;
|
||||
}
|
||||
|
||||
public function usesDataProvider(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getNumAssertions(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
public function getActualOutput(): string
|
||||
{
|
||||
return $this->output;
|
||||
}
|
||||
|
||||
public function hasOutput(): bool
|
||||
{
|
||||
return !empty($this->output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse --INI-- section key value pairs and return as array.
|
||||
*
|
||||
@@ -475,8 +501,8 @@ class PhptTestCase implements Test, SelfDescribing
|
||||
|
||||
private function getCoverageFiles(): array
|
||||
{
|
||||
$baseDir = \dirname(\realpath($this->filename)) . \DIRECTORY_SEPARATOR;
|
||||
$basename = \basename($this->filename, 'phpt');
|
||||
$baseDir = \dirname(\realpath($this->filename)) . \DIRECTORY_SEPARATOR;
|
||||
$basename = \basename($this->filename, 'phpt');
|
||||
|
||||
return [
|
||||
'coverage' => $baseDir . $basename . 'coverage',
|
||||
@@ -507,7 +533,10 @@ class PhptTestCase implements Test, SelfDescribing
|
||||
$globals = '';
|
||||
|
||||
if (!empty($GLOBALS['__PHPUNIT_BOOTSTRAP'])) {
|
||||
$globals = '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = ' . \var_export($GLOBALS['__PHPUNIT_BOOTSTRAP'], true) . ";\n";
|
||||
$globals = '$GLOBALS[\'__PHPUNIT_BOOTSTRAP\'] = ' . \var_export(
|
||||
$GLOBALS['__PHPUNIT_BOOTSTRAP'],
|
||||
true
|
||||
) . ";\n";
|
||||
}
|
||||
|
||||
$template->setVar(
|
||||
|
||||
@@ -95,8 +95,8 @@ final class ResultCacheExtension implements AfterSuccessfulTestHook, AfterSkippe
|
||||
{
|
||||
$matches = [];
|
||||
|
||||
if (\preg_match('/^(?:\S+::)?(?<name>\S+)(?:(?<data> with data set (?:#\d+|"[^"]+"))\s\()?/', $test, $matches)) {
|
||||
$test = $matches['name'] . ($matches['data'] ?? '');
|
||||
if (\preg_match('/^(?<name>\S+::\S+)(?:(?<dataname> with data set (?:#\d+|"[^"]+"))\s\()?/', $test, $matches)) {
|
||||
$test = $matches['name'] . ($matches['dataname'] ?? '');
|
||||
}
|
||||
|
||||
return $test;
|
||||
|
||||
@@ -64,6 +64,35 @@ final class TestSuiteSorter
|
||||
*/
|
||||
private $cache;
|
||||
|
||||
/**
|
||||
* @var array array<string> A list of normalized names of tests before reordering
|
||||
*/
|
||||
private $originalExecutionOrder = [];
|
||||
|
||||
/**
|
||||
* @var array array<string> A list of normalized names of tests affected by reordering
|
||||
*/
|
||||
private $executionOrder = [];
|
||||
|
||||
public static function getTestSorterUID(Test $test): string
|
||||
{
|
||||
if ($test instanceof PhptTestCase) {
|
||||
return $test->getName();
|
||||
}
|
||||
|
||||
if ($test instanceof TestCase) {
|
||||
$testName = $test->getName(true);
|
||||
|
||||
if (\strpos($testName, '::') === false) {
|
||||
$testName = \get_class($test) . '::' . $testName;
|
||||
}
|
||||
|
||||
return $testName;
|
||||
}
|
||||
|
||||
return $test->getName();
|
||||
}
|
||||
|
||||
public function __construct(?TestResultCacheInterface $cache = null)
|
||||
{
|
||||
$this->cache = $cache ?? new NullTestResultCache;
|
||||
@@ -72,7 +101,7 @@ final class TestSuiteSorter
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDependencies, int $orderDefects): void
|
||||
public function reorderTestsInSuite(Test $suite, int $order, bool $resolveDependencies, int $orderDefects, bool $isRootTestSuite = true): void
|
||||
{
|
||||
$allowedOrders = [
|
||||
self::ORDER_DEFAULT,
|
||||
@@ -98,9 +127,13 @@ final class TestSuiteSorter
|
||||
);
|
||||
}
|
||||
|
||||
if ($isRootTestSuite) {
|
||||
$this->originalExecutionOrder = $this->calculateTestExecutionOrder($suite);
|
||||
}
|
||||
|
||||
if ($suite instanceof TestSuite) {
|
||||
foreach ($suite as $_suite) {
|
||||
$this->reorderTestsInSuite($_suite, $order, $resolveDependencies, $orderDefects);
|
||||
$this->reorderTestsInSuite($_suite, $order, $resolveDependencies, $orderDefects, false);
|
||||
}
|
||||
|
||||
if ($orderDefects === self::ORDER_DEFECTS_FIRST) {
|
||||
@@ -109,6 +142,20 @@ final class TestSuiteSorter
|
||||
|
||||
$this->sort($suite, $order, $resolveDependencies, $orderDefects);
|
||||
}
|
||||
|
||||
if ($isRootTestSuite) {
|
||||
$this->executionOrder = $this->calculateTestExecutionOrder($suite);
|
||||
}
|
||||
}
|
||||
|
||||
public function getOriginalExecutionOrder(): array
|
||||
{
|
||||
return $this->originalExecutionOrder;
|
||||
}
|
||||
|
||||
public function getExecutionOrder(): array
|
||||
{
|
||||
return $this->executionOrder;
|
||||
}
|
||||
|
||||
private function sort(TestSuite $suite, int $order, bool $resolveDependencies, int $orderDefects): void
|
||||
@@ -139,9 +186,11 @@ final class TestSuiteSorter
|
||||
$max = 0;
|
||||
|
||||
foreach ($suite->tests() as $test) {
|
||||
if (!isset($this->defectSortOrder[$test->getName()])) {
|
||||
$this->defectSortOrder[$test->getName()] = self::DEFECT_SORT_WEIGHT[$this->cache->getState($test->getName())];
|
||||
$max = \max($max, $this->defectSortOrder[$test->getName()]);
|
||||
$testname = self::getTestSorterUID($test);
|
||||
|
||||
if (!isset($this->defectSortOrder[$testname])) {
|
||||
$this->defectSortOrder[$testname] = self::DEFECT_SORT_WEIGHT[$this->cache->getState($testname)];
|
||||
$max = \max($max, $this->defectSortOrder[$testname]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,12 +252,8 @@ final class TestSuiteSorter
|
||||
*/
|
||||
private function cmpDefectPriorityAndTime(Test $a, Test $b): int
|
||||
{
|
||||
if (!$a instanceof TestCase || !$b instanceof TestCase) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$priorityA = $this->defectSortOrder[$a->getName()] ?? 0;
|
||||
$priorityB = $this->defectSortOrder[$b->getName()] ?? 0;
|
||||
$priorityA = $this->defectSortOrder[self::getTestSorterUID($a)] ?? 0;
|
||||
$priorityB = $this->defectSortOrder[self::getTestSorterUID($b)] ?? 0;
|
||||
|
||||
if ($priorityB <=> $priorityA) {
|
||||
// Sort defect weight descending
|
||||
@@ -228,11 +273,7 @@ final class TestSuiteSorter
|
||||
*/
|
||||
private function cmpDuration(Test $a, Test $b): int
|
||||
{
|
||||
if (!$a instanceof TestCase || !$b instanceof TestCase) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $this->cache->getTime($a->getName()) <=> $this->cache->getTime($b->getName());
|
||||
return $this->cache->getTime(self::getTestSorterUID($a)) <=> $this->cache->getTime(self::getTestSorterUID($b));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -258,7 +299,7 @@ final class TestSuiteSorter
|
||||
do {
|
||||
$todoNames = \array_map(
|
||||
function ($test) {
|
||||
return $this->getNormalizedTestName($test);
|
||||
return self::getTestSorterUID($test);
|
||||
},
|
||||
$tests
|
||||
);
|
||||
@@ -274,20 +315,6 @@ final class TestSuiteSorter
|
||||
return \array_merge($newTestOrder, $tests);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataProviderTestSuite|TestCase $test
|
||||
*
|
||||
* @return string Full test name as "TestSuiteClassName::testMethodName"
|
||||
*/
|
||||
private function getNormalizedTestName($test): string
|
||||
{
|
||||
if (\strpos($test->getName(), '::') !== false) {
|
||||
return $test->getName();
|
||||
}
|
||||
|
||||
return \get_class($test) . '::' . $test->getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DataProviderTestSuite|TestCase $test
|
||||
*
|
||||
@@ -310,4 +337,21 @@ final class TestSuiteSorter
|
||||
|
||||
return $names;
|
||||
}
|
||||
|
||||
private function calculateTestExecutionOrder(Test $suite): array
|
||||
{
|
||||
$tests = [];
|
||||
|
||||
if ($suite instanceof TestSuite) {
|
||||
foreach ($suite->tests() as $test) {
|
||||
if (!($test instanceof TestSuite)) {
|
||||
$tests[] = self::getTestSorterUID($test);
|
||||
} else {
|
||||
$tests = \array_merge($tests, $this->calculateTestExecutionOrder($test));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $tests;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class Version
|
||||
}
|
||||
|
||||
if (self::$version === null) {
|
||||
$version = new VersionId('7.4.0', \dirname(__DIR__, 2));
|
||||
$version = new VersionId('7.5.1', \dirname(__DIR__, 2));
|
||||
self::$version = $version->getVersion();
|
||||
}
|
||||
|
||||
|
||||
@@ -1173,7 +1173,7 @@ Configuration Options:
|
||||
--include-path <path(s)> Prepend PHP's include_path with given path(s)
|
||||
-d key[=value] Sets a php.ini value
|
||||
--generate-configuration Generate configuration file with suggested settings
|
||||
--cache-result-file==<FILE> Specify result cache path and filename
|
||||
--cache-result-file=<file> Specify result cache path and filename
|
||||
|
||||
Miscellaneous Options:
|
||||
|
||||
|
||||
16
vendor/phpunit/phpunit/src/TextUI/TestRunner.php
vendored
16
vendor/phpunit/phpunit/src/TextUI/TestRunner.php
vendored
@@ -39,6 +39,7 @@ use PHPUnit\Util\Configuration;
|
||||
use PHPUnit\Util\Log\JUnit;
|
||||
use PHPUnit\Util\Log\TeamCity;
|
||||
use PHPUnit\Util\Printer;
|
||||
use PHPUnit\Util\TestDox\CliTestDoxPrinter;
|
||||
use PHPUnit\Util\TestDox\HtmlResultPrinter;
|
||||
use PHPUnit\Util\TestDox\TextResultPrinter;
|
||||
use PHPUnit\Util\TestDox\XmlResultPrinter;
|
||||
@@ -158,6 +159,11 @@ class TestRunner extends BaseTestRunner
|
||||
|
||||
$this->handleConfiguration($arguments);
|
||||
|
||||
if (\is_int($arguments['columns']) && $arguments['columns'] < 16) {
|
||||
$arguments['columns'] = 16;
|
||||
$tooFewColumnsRequested = true;
|
||||
}
|
||||
|
||||
if (isset($arguments['bootstrap'])) {
|
||||
$GLOBALS['__PHPUNIT_BOOTSTRAP'] = $arguments['bootstrap'];
|
||||
}
|
||||
@@ -198,6 +204,7 @@ class TestRunner extends BaseTestRunner
|
||||
$sorter = new TestSuiteSorter($cache);
|
||||
|
||||
$sorter->reorderTestsInSuite($suite, $arguments['executionOrder'], $arguments['resolveDependencies'], $arguments['executionOrderDefects']);
|
||||
$originalExecutionOrder = $sorter->getOriginalExecutionOrder();
|
||||
|
||||
unset($sorter);
|
||||
}
|
||||
@@ -304,6 +311,11 @@ class TestRunner extends BaseTestRunner
|
||||
$arguments['columns'],
|
||||
$arguments['reverseList']
|
||||
);
|
||||
|
||||
if (isset($originalExecutionOrder) && ($this->printer instanceof CliTestDoxPrinter)) {
|
||||
/* @var CliTestDoxPrinter */
|
||||
$this->printer->setOriginalExecutionOrder($originalExecutionOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -354,6 +366,10 @@ class TestRunner extends BaseTestRunner
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($tooFewColumnsRequested)) {
|
||||
$this->writeMessage('Error', 'Less than 16 columns requested, number of columns set to 16');
|
||||
}
|
||||
|
||||
if ($this->runtime->discardsComments()) {
|
||||
$this->writeMessage('Warning', 'opcache.save_comments=0 set; annotations will not work');
|
||||
}
|
||||
|
||||
26
vendor/phpunit/phpunit/src/Util/Log/JUnit.php
vendored
26
vendor/phpunit/phpunit/src/Util/Log/JUnit.php
vendored
@@ -15,7 +15,6 @@ use PHPUnit\Framework\AssertionFailedError;
|
||||
use PHPUnit\Framework\ExceptionWrapper;
|
||||
use PHPUnit\Framework\SelfDescribing;
|
||||
use PHPUnit\Framework\Test;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\TestFailure;
|
||||
use PHPUnit\Framework\TestListener;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
@@ -291,15 +290,17 @@ class JUnit extends Printer implements TestListener
|
||||
*/
|
||||
public function startTest(Test $test): void
|
||||
{
|
||||
if (!$test instanceof TestCase) {
|
||||
return;
|
||||
$usesDataprovider = false;
|
||||
|
||||
if (\method_exists($test, 'usesDataProvider')) {
|
||||
$usesDataprovider = $test->usesDataProvider();
|
||||
}
|
||||
|
||||
$testCase = $this->document->createElement('testcase');
|
||||
$testCase->setAttribute('name', $test->getName());
|
||||
|
||||
$class = new ReflectionClass($test);
|
||||
$methodName = $test->getName(!$test->usesDataProvider());
|
||||
$methodName = $test->getName(!$usesDataprovider);
|
||||
|
||||
if ($class->hasMethod($methodName)) {
|
||||
$method = $class->getMethod($methodName);
|
||||
@@ -318,11 +319,12 @@ class JUnit extends Printer implements TestListener
|
||||
*/
|
||||
public function endTest(Test $test, float $time): void
|
||||
{
|
||||
if (!$test instanceof TestCase) {
|
||||
return;
|
||||
$numAssertions = 0;
|
||||
|
||||
if (\method_exists($test, 'getNumAssertions')) {
|
||||
$numAssertions = $test->getNumAssertions();
|
||||
}
|
||||
|
||||
$numAssertions = $test->getNumAssertions();
|
||||
$this->testSuiteAssertions[$this->testSuiteLevel] += $numAssertions;
|
||||
|
||||
$this->currentTestCase->setAttribute(
|
||||
@@ -342,10 +344,16 @@ class JUnit extends Printer implements TestListener
|
||||
$this->testSuiteTests[$this->testSuiteLevel]++;
|
||||
$this->testSuiteTimes[$this->testSuiteLevel] += $time;
|
||||
|
||||
if ($test->hasOutput()) {
|
||||
$testOutput = '';
|
||||
|
||||
if (\method_exists($test, 'hasOutput') && \method_exists($test, 'getActualOutput')) {
|
||||
$testOutput = $test->hasOutput() ? $test->getActualOutput() : '';
|
||||
}
|
||||
|
||||
if (!empty($testOutput)) {
|
||||
$systemOut = $this->document->createElement(
|
||||
'system-out',
|
||||
Xml::prepareString($test->getActualOutput())
|
||||
Xml::prepareString($testOutput)
|
||||
);
|
||||
|
||||
$this->currentTestCase->appendChild($systemOut);
|
||||
|
||||
32
vendor/phpunit/phpunit/src/Util/Log/TeamCity.php
vendored
32
vendor/phpunit/phpunit/src/Util/Log/TeamCity.php
vendored
@@ -57,10 +57,6 @@ class TeamCity extends ResultPrinter
|
||||
*/
|
||||
public function addError(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
if (!$test instanceof TestCase) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->printEvent(
|
||||
'testFailed',
|
||||
[
|
||||
@@ -79,10 +75,6 @@ class TeamCity extends ResultPrinter
|
||||
*/
|
||||
public function addWarning(Test $test, Warning $e, float $time): void
|
||||
{
|
||||
if (!$test instanceof TestCase) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->printEvent(
|
||||
'testFailed',
|
||||
[
|
||||
@@ -101,10 +93,6 @@ class TeamCity extends ResultPrinter
|
||||
*/
|
||||
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
|
||||
{
|
||||
if (!$test instanceof TestCase) {
|
||||
return;
|
||||
}
|
||||
|
||||
$parameters = [
|
||||
'name' => $test->getName(),
|
||||
'message' => self::getMessage($e),
|
||||
@@ -144,10 +132,6 @@ class TeamCity extends ResultPrinter
|
||||
*/
|
||||
public function addIncompleteTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
if (!$test instanceof TestCase) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->printIgnoredTest($test->getName(), $t, $time);
|
||||
}
|
||||
|
||||
@@ -158,10 +142,6 @@ class TeamCity extends ResultPrinter
|
||||
*/
|
||||
public function addRiskyTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
if (!$test instanceof TestCase) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->addError($test, $t, $time);
|
||||
}
|
||||
|
||||
@@ -172,10 +152,6 @@ class TeamCity extends ResultPrinter
|
||||
*/
|
||||
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
if (!$test instanceof TestCase) {
|
||||
return;
|
||||
}
|
||||
|
||||
$testName = $test->getName();
|
||||
|
||||
if ($this->startedTestName !== $testName) {
|
||||
@@ -277,10 +253,6 @@ class TeamCity extends ResultPrinter
|
||||
*/
|
||||
public function startTest(Test $test): void
|
||||
{
|
||||
if (!$test instanceof TestCase) {
|
||||
return;
|
||||
}
|
||||
|
||||
$testName = $test->getName();
|
||||
$this->startedTestName = $testName;
|
||||
$params = ['name' => $testName];
|
||||
@@ -299,10 +271,6 @@ class TeamCity extends ResultPrinter
|
||||
*/
|
||||
public function endTest(Test $test, float $time): void
|
||||
{
|
||||
if (!$test instanceof TestCase) {
|
||||
return;
|
||||
}
|
||||
|
||||
parent::endTest($test, $time);
|
||||
|
||||
$this->printEvent(
|
||||
|
||||
67
vendor/phpunit/phpunit/src/Util/Test.php
vendored
67
vendor/phpunit/phpunit/src/Util/Test.php
vendored
@@ -10,6 +10,7 @@
|
||||
namespace PHPUnit\Util;
|
||||
|
||||
use PharIo\Version\VersionConstraintParser;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use PHPUnit\Framework\CodeCoverageException;
|
||||
use PHPUnit\Framework\Exception;
|
||||
use PHPUnit\Framework\InvalidCoversTargetException;
|
||||
@@ -276,7 +277,7 @@ final class Test
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($required['OSFAMILY']) && $required['OSFAMILY'] !== (new OperatingSystem())->getFamily()) {
|
||||
if (!empty($required['OSFAMILY']) && $required['OSFAMILY'] !== (new OperatingSystem)->getFamily()) {
|
||||
$missing[] = \sprintf('Operating system %s is required.', $required['OSFAMILY']);
|
||||
}
|
||||
|
||||
@@ -413,7 +414,7 @@ final class Test
|
||||
$data = self::getDataFromTestWithAnnotation($docComment);
|
||||
}
|
||||
|
||||
if (\is_array($data) && empty($data)) {
|
||||
if ($data === []) {
|
||||
throw new SkippedTestError;
|
||||
}
|
||||
|
||||
@@ -706,26 +707,38 @@ final class Test
|
||||
$class = new ReflectionClass($className);
|
||||
|
||||
foreach ($class->getMethods() as $method) {
|
||||
if (self::isBeforeClassMethod($method)) {
|
||||
\array_unshift(
|
||||
self::$hookMethods[$className]['beforeClass'],
|
||||
$method->getName()
|
||||
);
|
||||
if ($method->getDeclaringClass()->getName() === Assert::class) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (self::isBeforeMethod($method)) {
|
||||
\array_unshift(
|
||||
self::$hookMethods[$className]['before'],
|
||||
$method->getName()
|
||||
);
|
||||
if ($method->getDeclaringClass()->getName() === TestCase::class) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (self::isAfterMethod($method)) {
|
||||
self::$hookMethods[$className]['after'][] = $method->getName();
|
||||
}
|
||||
if ($methodComment = $method->getDocComment()) {
|
||||
if ($method->isStatic()) {
|
||||
if (\strpos($methodComment, '@beforeClass') !== false) {
|
||||
\array_unshift(
|
||||
self::$hookMethods[$className]['beforeClass'],
|
||||
$method->getName()
|
||||
);
|
||||
}
|
||||
|
||||
if (self::isAfterClassMethod($method)) {
|
||||
self::$hookMethods[$className]['afterClass'][] = $method->getName();
|
||||
if (\strpos($methodComment, '@afterClass') !== false) {
|
||||
self::$hookMethods[$className]['afterClass'][] = $method->getName();
|
||||
}
|
||||
}
|
||||
|
||||
if (\preg_match('/@before\b/', $methodComment) > 0) {
|
||||
\array_unshift(
|
||||
self::$hookMethods[$className]['before'],
|
||||
$method->getName()
|
||||
);
|
||||
}
|
||||
|
||||
if (\preg_match('/@after\b/', $methodComment) > 0) {
|
||||
self::$hookMethods[$className]['after'][] = $method->getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (ReflectionException $e) {
|
||||
@@ -1076,26 +1089,6 @@ final class Test
|
||||
return $result;
|
||||
}
|
||||
|
||||
private static function isBeforeClassMethod(ReflectionMethod $method): bool
|
||||
{
|
||||
return $method->isStatic() && \strpos($method->getDocComment(), '@beforeClass') !== false;
|
||||
}
|
||||
|
||||
private static function isBeforeMethod(ReflectionMethod $method): bool
|
||||
{
|
||||
return \preg_match('/@before\b/', $method->getDocComment()) > 0;
|
||||
}
|
||||
|
||||
private static function isAfterClassMethod(ReflectionMethod $method): bool
|
||||
{
|
||||
return $method->isStatic() && \strpos($method->getDocComment(), '@afterClass') !== false;
|
||||
}
|
||||
|
||||
private static function isAfterMethod(ReflectionMethod $method): bool
|
||||
{
|
||||
return \preg_match('/@after\b/', $method->getDocComment()) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Trims any extensions from version string that follows after
|
||||
* the <major>.<minor>[.<patch>] format
|
||||
|
||||
@@ -16,8 +16,8 @@ use PHPUnit\Framework\TestResult;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
use PHPUnit\Framework\Warning;
|
||||
use PHPUnit\Runner\PhptTestCase;
|
||||
use PHPUnit\Runner\TestSuiteSorter;
|
||||
use PHPUnit\TextUI\ResultPrinter;
|
||||
use PHPUnit\Util\TestDox\TestResult as TestDoxTestResult;
|
||||
use SebastianBergmann\Timer\Timer;
|
||||
|
||||
/**
|
||||
@@ -27,17 +27,7 @@ use SebastianBergmann\Timer\Timer;
|
||||
class CliTestDoxPrinter extends ResultPrinter
|
||||
{
|
||||
/**
|
||||
* @var TestDoxTestResult
|
||||
*/
|
||||
private $currentTestResult;
|
||||
|
||||
/**
|
||||
* @var TestDoxTestResult
|
||||
*/
|
||||
private $previousTestResult;
|
||||
|
||||
/**
|
||||
* @var TestDoxTestResult[]
|
||||
* @var int[]
|
||||
*/
|
||||
private $nonSuccessfulTestResults = [];
|
||||
|
||||
@@ -46,42 +36,95 @@ class CliTestDoxPrinter extends ResultPrinter
|
||||
*/
|
||||
private $prettifier;
|
||||
|
||||
public function __construct($out = null, bool $verbose = false, $colors = self::COLOR_DEFAULT, bool $debug = false, $numberOfColumns = 80, bool $reverse = false)
|
||||
{
|
||||
/**
|
||||
* @var int The number of test results received from the TestRunner
|
||||
*/
|
||||
private $testIndex = 0;
|
||||
|
||||
/**
|
||||
* @var int The number of test results already sent to the output
|
||||
*/
|
||||
private $testFlushIndex = 0;
|
||||
|
||||
/**
|
||||
* @var array Buffer for write()
|
||||
*/
|
||||
private $outputBuffer = [];
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
private $bufferExecutionOrder = false;
|
||||
|
||||
/**
|
||||
* @var array array<string>
|
||||
*/
|
||||
private $originalExecutionOrder = [];
|
||||
|
||||
/**
|
||||
* @var string Classname of the current test
|
||||
*/
|
||||
private $className = '';
|
||||
|
||||
/**
|
||||
* @var string Classname of the previous test; empty for first test
|
||||
*/
|
||||
private $lastClassName = '';
|
||||
|
||||
/**
|
||||
* @var string Prettified test name of current test
|
||||
*/
|
||||
private $testMethod;
|
||||
|
||||
/**
|
||||
* @var string Test result message of current test
|
||||
*/
|
||||
private $testResultMessage;
|
||||
|
||||
/**
|
||||
* @var bool Test result message of current test contains a verbose dump
|
||||
*/
|
||||
private $lastFlushedTestWasVerbose = false;
|
||||
|
||||
public function __construct(
|
||||
$out = null,
|
||||
bool $verbose = false,
|
||||
$colors = self::COLOR_DEFAULT,
|
||||
bool $debug = false,
|
||||
$numberOfColumns = 80,
|
||||
bool $reverse = false
|
||||
) {
|
||||
parent::__construct($out, $verbose, $colors, $debug, $numberOfColumns, $reverse);
|
||||
|
||||
$this->prettifier = new NamePrettifier;
|
||||
}
|
||||
|
||||
public function setOriginalExecutionOrder(array $order): void
|
||||
{
|
||||
$this->originalExecutionOrder = $order;
|
||||
$this->bufferExecutionOrder = !empty($order);
|
||||
}
|
||||
|
||||
public function startTest(Test $test): void
|
||||
{
|
||||
if (!$test instanceof TestCase && !$test instanceof PhptTestCase && !$test instanceof TestSuite) {
|
||||
return;
|
||||
}
|
||||
|
||||
$class = \get_class($test);
|
||||
$this->lastTestFailed = false;
|
||||
$this->lastClassName = $this->className;
|
||||
$this->testResultMessage = '';
|
||||
|
||||
if ($test instanceof TestCase) {
|
||||
$className = $this->prettifier->prettifyTestClass($class);
|
||||
$className = $this->prettifier->prettifyTestClass(\get_class($test));
|
||||
$testMethod = $this->prettifier->prettifyTestCase($test);
|
||||
} elseif ($test instanceof TestSuite) {
|
||||
$className = $test->getName();
|
||||
$testMethod = \sprintf(
|
||||
'Error bootstapping suite (most likely in %s::setUpBeforeClass)',
|
||||
$test->getName()
|
||||
);
|
||||
} elseif ($test instanceof PhptTestCase) {
|
||||
$className = $class;
|
||||
$className = \get_class($test);
|
||||
$testMethod = $test->getName();
|
||||
}
|
||||
|
||||
$this->currentTestResult = new TestDoxTestResult(
|
||||
function (string $color, string $buffer) {
|
||||
return $this->formatWithColor($color, $buffer);
|
||||
},
|
||||
$className,
|
||||
$testMethod
|
||||
);
|
||||
$this->className = $className;
|
||||
$this->testMethod = $testMethod;
|
||||
|
||||
parent::startTest($test);
|
||||
}
|
||||
@@ -92,70 +135,120 @@ class CliTestDoxPrinter extends ResultPrinter
|
||||
return;
|
||||
}
|
||||
|
||||
parent::endTest($test, $time);
|
||||
|
||||
$this->currentTestResult->setRuntime($time);
|
||||
|
||||
$this->write($this->currentTestResult->toString($this->previousTestResult, $this->verbose));
|
||||
|
||||
$this->previousTestResult = $this->currentTestResult;
|
||||
|
||||
if (!$this->currentTestResult->isTestSuccessful()) {
|
||||
$this->nonSuccessfulTestResults[] = $this->currentTestResult;
|
||||
if ($test instanceof TestCase || $test instanceof PhptTestCase) {
|
||||
$this->testIndex++;
|
||||
}
|
||||
|
||||
if ($this->lastTestFailed) {
|
||||
$resultMessage = $this->testResultMessage;
|
||||
$this->nonSuccessfulTestResults[] = $this->testIndex;
|
||||
} else {
|
||||
$resultMessage = $this->formatTestResultMessage(
|
||||
$this->formatWithColor('fg-green', '✔'),
|
||||
'',
|
||||
$time,
|
||||
$this->verbose
|
||||
);
|
||||
}
|
||||
|
||||
if ($this->bufferExecutionOrder) {
|
||||
$this->bufferTestResult($test, $resultMessage);
|
||||
$this->flushOutputBuffer();
|
||||
} else {
|
||||
$this->writeTestResult($resultMessage);
|
||||
|
||||
if ($this->lastTestFailed) {
|
||||
$this->bufferTestResult($test, $resultMessage);
|
||||
}
|
||||
}
|
||||
|
||||
parent::endTest($test, $time);
|
||||
}
|
||||
|
||||
public function addError(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->currentTestResult->fail(
|
||||
$this->lastTestFailed = true;
|
||||
$this->testResultMessage = $this->formatTestResultMessage(
|
||||
$this->formatWithColor('fg-yellow', '✘'),
|
||||
(string) $t
|
||||
(string) $t,
|
||||
$time,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
public function addWarning(Test $test, Warning $e, float $time): void
|
||||
{
|
||||
$this->currentTestResult->fail(
|
||||
$this->lastTestFailed = true;
|
||||
$this->testResultMessage = $this->formatTestResultMessage(
|
||||
$this->formatWithColor('fg-yellow', '✘'),
|
||||
(string) $e
|
||||
(string) $e,
|
||||
$time,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
|
||||
{
|
||||
$this->currentTestResult->fail(
|
||||
$this->lastTestFailed = true;
|
||||
$this->testResultMessage = $this->formatTestResultMessage(
|
||||
$this->formatWithColor('fg-red', '✘'),
|
||||
(string) $e
|
||||
(string) $e,
|
||||
$time,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
public function addIncompleteTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->currentTestResult->fail(
|
||||
$this->lastTestFailed = true;
|
||||
$this->testResultMessage = $this->formatTestResultMessage(
|
||||
$this->formatWithColor('fg-yellow', '∅'),
|
||||
(string) $t,
|
||||
true
|
||||
$time,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
public function addRiskyTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->currentTestResult->fail(
|
||||
$this->lastTestFailed = true;
|
||||
$this->testResultMessage = $this->formatTestResultMessage(
|
||||
$this->formatWithColor('fg-yellow', '☢'),
|
||||
(string) $t,
|
||||
true
|
||||
$time,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->currentTestResult->fail(
|
||||
$this->lastTestFailed = true;
|
||||
$this->testResultMessage = $this->formatTestResultMessage(
|
||||
$this->formatWithColor('fg-yellow', '→'),
|
||||
(string) $t,
|
||||
true
|
||||
$time,
|
||||
false
|
||||
);
|
||||
}
|
||||
|
||||
public function bufferTestResult(Test $test, string $msg): void
|
||||
{
|
||||
$this->outputBuffer[$this->testIndex] = [
|
||||
'className' => $this->className,
|
||||
'testName' => TestSuiteSorter::getTestSorterUID($test),
|
||||
'testMethod' => $this->testMethod,
|
||||
'message' => $msg,
|
||||
'failed' => $this->lastTestFailed,
|
||||
'verbose' => $this->lastFlushedTestWasVerbose,
|
||||
];
|
||||
}
|
||||
|
||||
public function writeTestResult(string $msg): void
|
||||
{
|
||||
$msg = $this->formatTestSuiteHeader($this->lastClassName, $this->className, $msg);
|
||||
$this->write($msg);
|
||||
}
|
||||
|
||||
public function writeProgress(string $progress): void
|
||||
{
|
||||
}
|
||||
@@ -178,26 +271,159 @@ class CliTestDoxPrinter extends ResultPrinter
|
||||
$this->write("\n" . Timer::resourceUsage() . "\n\n");
|
||||
}
|
||||
|
||||
private function printNonSuccessfulTestsSummary(int $numberOfExecutedTests): void
|
||||
private function flushOutputBuffer(): void
|
||||
{
|
||||
$numberOfNonSuccessfulTests = \count($this->nonSuccessfulTestResults);
|
||||
|
||||
if ($numberOfNonSuccessfulTests === 0) {
|
||||
if ($this->testFlushIndex === $this->testIndex) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (($numberOfNonSuccessfulTests / $numberOfExecutedTests) >= 0.7) {
|
||||
if ($this->testFlushIndex > 0) {
|
||||
$prevResult = $this->getTestResultByName($this->originalExecutionOrder[$this->testFlushIndex - 1]);
|
||||
} else {
|
||||
$prevResult = $this->getEmptyTestResult();
|
||||
}
|
||||
|
||||
do {
|
||||
$flushed = false;
|
||||
$result = $this->getTestResultByName($this->originalExecutionOrder[$this->testFlushIndex]);
|
||||
|
||||
if (!empty($result)) {
|
||||
$this->writeBufferTestResult($prevResult, $result);
|
||||
$this->testFlushIndex++;
|
||||
$prevResult = $result;
|
||||
$flushed = true;
|
||||
}
|
||||
} while ($flushed && $this->testFlushIndex < $this->testIndex);
|
||||
}
|
||||
|
||||
private function writeBufferTestResult(array $prevResult, array $result): void
|
||||
{
|
||||
// Write spacer line for new suite headers and after verbose messages
|
||||
if ($prevResult['testName'] !== '' &&
|
||||
($prevResult['verbose'] === true || $prevResult['className'] !== $result['className'])) {
|
||||
$this->write("\n");
|
||||
}
|
||||
|
||||
// Write suite header
|
||||
if ($prevResult['className'] !== $result['className']) {
|
||||
$this->write($result['className'] . "\n");
|
||||
}
|
||||
|
||||
// Write the test result itself
|
||||
$this->write($result['message']);
|
||||
}
|
||||
|
||||
private function getTestResultByName(string $testName): array
|
||||
{
|
||||
foreach ($this->outputBuffer as $result) {
|
||||
if ($result['testName'] === $testName) {
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
private function formatTestSuiteHeader(?string $lastClassName, string $className, string $msg): string
|
||||
{
|
||||
if ($lastClassName === null || $className !== $lastClassName) {
|
||||
return \sprintf(
|
||||
"%s%s\n%s",
|
||||
($this->lastClassName !== '') ? "\n" : '',
|
||||
$className,
|
||||
$msg
|
||||
);
|
||||
}
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
private function formatTestResultMessage(
|
||||
string $symbol,
|
||||
string $resultMessage,
|
||||
float $time,
|
||||
bool $alwaysVerbose = false
|
||||
): string {
|
||||
$additionalInformation = $this->getFormattedAdditionalInformation($resultMessage, $alwaysVerbose);
|
||||
$msg = \sprintf(
|
||||
" %s %s%s\n%s",
|
||||
$symbol,
|
||||
$this->testMethod,
|
||||
$this->verbose ? ' ' . $this->getFormattedRuntime($time) : '',
|
||||
$additionalInformation
|
||||
);
|
||||
|
||||
$this->lastFlushedTestWasVerbose = !empty($additionalInformation);
|
||||
|
||||
return $msg;
|
||||
}
|
||||
|
||||
private function getFormattedRuntime(float $time): string
|
||||
{
|
||||
if ($time > 5) {
|
||||
return $this->formatWithColor('fg-red', \sprintf('[%.2f ms]', $time * 1000));
|
||||
}
|
||||
|
||||
if ($time > 1) {
|
||||
return $this->formatWithColor('fg-yellow', \sprintf('[%.2f ms]', $time * 1000));
|
||||
}
|
||||
|
||||
return \sprintf('[%.2f ms]', $time * 1000);
|
||||
}
|
||||
|
||||
private function getFormattedAdditionalInformation(string $resultMessage, bool $verbose): string
|
||||
{
|
||||
if ($resultMessage === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!($this->verbose || $verbose)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return \sprintf(
|
||||
" │\n%s\n",
|
||||
\implode(
|
||||
"\n",
|
||||
\array_map(
|
||||
function (string $text) {
|
||||
return \sprintf(' │ %s', $text);
|
||||
},
|
||||
\explode("\n", $resultMessage)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private function printNonSuccessfulTestsSummary(int $numberOfExecutedTests): void
|
||||
{
|
||||
if (empty($this->nonSuccessfulTestResults)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((\count($this->nonSuccessfulTestResults) / $numberOfExecutedTests) >= 0.7) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->write("Summary of non-successful tests:\n\n");
|
||||
|
||||
$previousTestResult = null;
|
||||
$prevResult = $this->getEmptyTestResult();
|
||||
|
||||
foreach ($this->nonSuccessfulTestResults as $testResult) {
|
||||
$this->write($testResult->toString($previousTestResult, $this->verbose));
|
||||
|
||||
$previousTestResult = $testResult;
|
||||
foreach ($this->nonSuccessfulTestResults as $testIndex) {
|
||||
$result = $this->outputBuffer[$testIndex];
|
||||
$this->writeBufferTestResult($prevResult, $result);
|
||||
$prevResult = $result;
|
||||
}
|
||||
}
|
||||
|
||||
private function getEmptyTestResult(): array
|
||||
{
|
||||
return [
|
||||
'className' => '',
|
||||
'testName' => '',
|
||||
'message' => '',
|
||||
'failed' => '',
|
||||
'verbose' => '',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,20 +63,19 @@ final class NamePrettifier
|
||||
$annotations = $test->getAnnotations();
|
||||
$annotationWithPlaceholders = false;
|
||||
|
||||
$callback = static function (string $variable): string {
|
||||
return \sprintf('/%s(?=\b)/', \preg_quote($variable, '/'));
|
||||
};
|
||||
|
||||
if (isset($annotations['method']['testdox'][0])) {
|
||||
$result = $annotations['method']['testdox'][0];
|
||||
|
||||
if (\strpos($result, '$') !== false) {
|
||||
$annotation = $annotations['method']['testdox'][0];
|
||||
$providedData = $this->mapTestMethodParameterNamesToProvidedDataValues($test);
|
||||
$variables = \array_map($callback, \array_keys($providedData));
|
||||
|
||||
$result = \trim(
|
||||
\str_replace(
|
||||
\array_keys($providedData),
|
||||
$providedData,
|
||||
$annotation
|
||||
)
|
||||
);
|
||||
$result = \trim(\preg_replace($variables, $providedData, $annotation));
|
||||
|
||||
$annotationWithPlaceholders = true;
|
||||
}
|
||||
@@ -85,7 +84,7 @@ final class NamePrettifier
|
||||
}
|
||||
|
||||
if ($test->usesDataProvider() && !$annotationWithPlaceholders) {
|
||||
$result .= ' data set "' . $test->dataDescription() . '"';
|
||||
$result .= $test->getDataSetAsString(false);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@@ -158,11 +157,15 @@ final class NamePrettifier
|
||||
{
|
||||
$reflector = new \ReflectionMethod(\get_class($test), $test->getName(false));
|
||||
$providedData = [];
|
||||
$providedDataValues = $test->getProvidedData();
|
||||
$providedDataValues = \array_values($test->getProvidedData());
|
||||
$i = 0;
|
||||
|
||||
foreach ($reflector->getParameters() as $parameter) {
|
||||
$value = $providedDataValues[$i++];
|
||||
if (!\array_key_exists($i, $providedDataValues) && $parameter->isDefaultValueAvailable()) {
|
||||
$providedDataValues[$i] = $parameter->getDefaultValue();
|
||||
}
|
||||
|
||||
$value = $providedDataValues[$i++] ?? null;
|
||||
|
||||
if (\is_object($value)) {
|
||||
$reflector = new \ReflectionObject($value);
|
||||
@@ -176,7 +179,7 @@ final class NamePrettifier
|
||||
$value = \gettype($value);
|
||||
}
|
||||
|
||||
if (\is_bool($value) || \is_numeric($value)) {
|
||||
if (\is_bool($value) || \is_int($value) || \is_float($value)) {
|
||||
$exporter = new Exporter;
|
||||
|
||||
$value = $exporter->export($value);
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
*/
|
||||
namespace PHPUnit\Runner;
|
||||
|
||||
use PHPUnit\Framework\Test;
|
||||
|
||||
class TestResultCache implements \Serializable, TestResultCacheInterface
|
||||
{
|
||||
/**
|
||||
@@ -77,6 +79,15 @@ class TestResultCache implements \Serializable, TestResultCacheInterface
|
||||
return;
|
||||
}
|
||||
|
||||
if (!$this->createDirectory(\dirname($this->cacheFilename))) {
|
||||
throw new Exception(
|
||||
\sprintf(
|
||||
'Cannot create directory "%s" for result cache file',
|
||||
$this->cacheFilename
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
\file_put_contents(
|
||||
$this->cacheFilename,
|
||||
\serialize($this)
|
||||
@@ -176,4 +187,9 @@ class TestResultCache implements \Serializable, TestResultCacheInterface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function createDirectory(string $directory): bool
|
||||
{
|
||||
return !(!\is_dir($directory) && !@\mkdir($directory, 0777, true) && !\is_dir($directory));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ final class CountConstraint extends Constraint
|
||||
|
||||
public static function fromCount(int $count): self
|
||||
{
|
||||
$instance = new self();
|
||||
$instance = new self;
|
||||
|
||||
$instance->count = $count;
|
||||
|
||||
|
||||
@@ -13,12 +13,12 @@ class DataProviderDebugTest extends TestCase
|
||||
{
|
||||
public static function provider()
|
||||
{
|
||||
$obj2 = new \stdClass();
|
||||
$obj2 = new \stdClass;
|
||||
$obj2->foo = 'bar';
|
||||
|
||||
$obj3 = (object) [1, 2, "Test\r\n", 4, 5, 6, 7, 8];
|
||||
|
||||
$obj = new \stdClass();
|
||||
$obj = new \stdClass;
|
||||
//@codingStandardsIgnoreStart
|
||||
$obj->null = null;
|
||||
//@codingStandardsIgnoreEnd
|
||||
@@ -32,7 +32,7 @@ class DataProviderDebugTest extends TestCase
|
||||
$obj->array = ['foo' => 'bar'];
|
||||
$obj->self = $obj;
|
||||
|
||||
$storage = new \SplObjectStorage();
|
||||
$storage = new \SplObjectStorage;
|
||||
$storage->attach($obj2);
|
||||
$storage->foo = $obj;
|
||||
|
||||
@@ -42,7 +42,7 @@ class DataProviderDebugTest extends TestCase
|
||||
[[[1, 2, 3], [3, 4, 5]]],
|
||||
// \n\r and \r is converted to \n
|
||||
["this\nis\na\nvery\nvery\nvery\nvery\nvery\nvery\rlong\n\rtext"],
|
||||
[new \stdClass(), $obj, [], $storage, $obj3],
|
||||
[new \stdClass, $obj, [], $storage, $obj3],
|
||||
[\chr(0) . \chr(1) . \chr(2) . \chr(3) . \chr(4) . \chr(5), \implode('', \array_map('chr', \range(0x0e, 0x1f)))],
|
||||
[\chr(0x00) . \chr(0x09)],
|
||||
];
|
||||
|
||||
@@ -13,7 +13,7 @@ use PHPUnit\Framework\TestCase;
|
||||
|
||||
class SecondTest extends TestCase
|
||||
{
|
||||
const DUMMY = 'dummy';
|
||||
public const DUMMY = 'dummy';
|
||||
|
||||
public function testSecond(): void
|
||||
{
|
||||
|
||||
@@ -26,6 +26,6 @@ class FirstTest extends TestCase
|
||||
|
||||
public function provide(): void
|
||||
{
|
||||
throw new \Exception();
|
||||
throw new \Exception;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class DataProviderTestDoxTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider provider
|
||||
* @testdox Does something with
|
||||
* @testdox Does something
|
||||
*/
|
||||
public function testOne(): void
|
||||
{
|
||||
@@ -23,7 +23,15 @@ class DataProviderTestDoxTest extends TestCase
|
||||
/**
|
||||
* @dataProvider provider
|
||||
*/
|
||||
public function testDoesSomethingElseWith(): void
|
||||
public function testDoesSomethingElse(): void
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider providerWithIndexedArray
|
||||
*/
|
||||
public function testWithProviderWithIndexedArray($value): void
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
@@ -45,6 +53,14 @@ class DataProviderTestDoxTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
public function providerWithIndexedArray()
|
||||
{
|
||||
return [
|
||||
['first'],
|
||||
['second'],
|
||||
];
|
||||
}
|
||||
|
||||
public function placeHolderprovider(): array
|
||||
{
|
||||
return [
|
||||
|
||||
48
vendor/phpunit/phpunit/tests/_files/DataproviderExecutionOrderTest.php
vendored
Normal file
48
vendor/phpunit/phpunit/tests/_files/DataproviderExecutionOrderTest.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class DataproviderExecutionOrderTest extends TestCase
|
||||
{
|
||||
public function testFirstTestThatAlwaysWorks()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataproviderAdditions
|
||||
*/
|
||||
public function testAddNumbersWithADataprovider(int $a, int $b, int $sum)
|
||||
{
|
||||
$this->assertSame($sum, $a + $b);
|
||||
}
|
||||
|
||||
public function testTestInTheMiddleThatAlwaysWorks()
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider dataproviderAdditions
|
||||
*/
|
||||
public function testAddMoreNumbersWithADataprovider(int $a, int $b, int $sum)
|
||||
{
|
||||
$this->assertSame($sum, $a + $b);
|
||||
}
|
||||
|
||||
public function dataproviderAdditions()
|
||||
{
|
||||
return [
|
||||
'1+2=3' => [1, 2, 3],
|
||||
'2+1=3' => [2, 1, 3],
|
||||
'1+1=3' => [1, 1, 3],
|
||||
];
|
||||
}
|
||||
}
|
||||
1
vendor/phpunit/phpunit/tests/_files/DataproviderExecutionOrderTest_result_cache.txt
vendored
Normal file
1
vendor/phpunit/phpunit/tests/_files/DataproviderExecutionOrderTest_result_cache.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
C:30:"PHPUnit\Runner\TestResultCache":2119:{a:2:{s:7:"defects";a:5:{s:60:"tests/end-to-end/regression/GitHub/3396/issue-3396-test.phpt";i:3;s:88:"MultiDependencyExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+1=3"";i:3;s:92:"MultiDependencyExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+1=3"";i:3;s:85:"DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+1=3"";i:3;s:89:"DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+1=3"";i:3;}s:5:"times";a:17:{s:60:"tests/end-to-end/regression/GitHub/3396/issue-3396-test.phpt";d:0.115;s:63:"MultiDependencyExecutionOrderTest::testFirstTestThatAlwaysWorks";d:0;s:88:"MultiDependencyExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+2=3"";d:0;s:88:"MultiDependencyExecutionOrderTest::testAddNumbersWithADataprovider with data set "2+1=3"";d:0;s:88:"MultiDependencyExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+1=3"";d:0.003;s:69:"MultiDependencyExecutionOrderTest::testTestInTheMiddleThatAlwaysWorks";d:0;s:92:"MultiDependencyExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+2=3"";d:0;s:92:"MultiDependencyExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "2+1=3"";d:0;s:92:"MultiDependencyExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+1=3"";d:0;s:60:"DataproviderExecutionOrderTest::testFirstTestThatAlwaysWorks";d:0.002;s:85:"DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+2=3"";d:0;s:85:"DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "2+1=3"";d:0;s:85:"DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+1=3"";d:0.001;s:66:"DataproviderExecutionOrderTest::testTestInTheMiddleThatAlwaysWorks";d:0;s:89:"DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+2=3"";d:0;s:89:"DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "2+1=3"";d:0;s:89:"DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+1=3"";d:0;}}}
|
||||
@@ -16,14 +16,14 @@ class ExceptionNamespaceTest extends \PHPUnit\Framework\TestCase
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const ERROR_MESSAGE = 'Exception namespace message';
|
||||
public const ERROR_MESSAGE = 'Exception namespace message';
|
||||
|
||||
/**
|
||||
* Exception code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const ERROR_CODE = 200;
|
||||
public const ERROR_CODE = 200;
|
||||
|
||||
/**
|
||||
* @expectedException Class
|
||||
|
||||
@@ -16,21 +16,21 @@ class ExceptionTest extends TestCase
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const ERROR_MESSAGE = 'Exception message';
|
||||
public const ERROR_MESSAGE = 'Exception message';
|
||||
|
||||
/**
|
||||
* Exception message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const ERROR_MESSAGE_REGEX = '#regex#';
|
||||
public const ERROR_MESSAGE_REGEX = '#regex#';
|
||||
|
||||
/**
|
||||
* Exception code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const ERROR_CODE = 500;
|
||||
public const ERROR_CODE = 500;
|
||||
|
||||
/**
|
||||
* @expectedException FooBarBaz
|
||||
|
||||
@@ -13,13 +13,13 @@ class IgnoreCodeCoverageClassTest extends TestCase
|
||||
{
|
||||
public function testReturnTrue(): void
|
||||
{
|
||||
$sut = new IgnoreCodeCoverageClass();
|
||||
$sut = new IgnoreCodeCoverageClass;
|
||||
$this->assertTrue($sut->returnTrue());
|
||||
}
|
||||
|
||||
public function testReturnFalse(): void
|
||||
{
|
||||
$sut = new IgnoreCodeCoverageClass();
|
||||
$sut = new IgnoreCodeCoverageClass;
|
||||
$this->assertFalse($sut->returnFalse());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
C:30:"PHPUnit\Runner\TestResultCache":157:{a:2:{s:7:"defects";a:1:{s:8:"testFive";i:1;}s:5:"times";a:5:{s:7:"testOne";d:0;s:7:"testTwo";d:0;s:9:"testThree";d:0;s:8:"testFour";d:0;s:8:"testFive";d:0;}}}
|
||||
C:30:"PHPUnit\Runner\TestResultCache":289:{a:2:{s:7:"defects";a:1:{s:29:"MultiDependencyTest::testFive";i:1;}s:5:"times";a:5:{s:28:"MultiDependencyTest::testOne";d:0;s:28:"MultiDependencyTest::testTwo";d:0;s:30:"MultiDependencyTest::testThree";d:0;s:29:"MultiDependencyTest::testFour";d:0;s:29:"MultiDependencyTest::testFive";d:0;}}}
|
||||
121
vendor/phpunit/phpunit/tests/_files/MyTestListener.php
vendored
Normal file
121
vendor/phpunit/phpunit/tests/_files/MyTestListener.php
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
use PHPUnit\Framework\AssertionFailedError;
|
||||
use PHPUnit\Framework\Test;
|
||||
use PHPUnit\Framework\TestListener;
|
||||
use PHPUnit\Framework\TestSuite;
|
||||
use PHPUnit\Framework\Warning;
|
||||
|
||||
final class MyTestListener implements TestListener
|
||||
{
|
||||
private $endCount = 0;
|
||||
|
||||
private $errorCount = 0;
|
||||
|
||||
private $failureCount = 0;
|
||||
|
||||
private $warningCount = 0;
|
||||
|
||||
private $notImplementedCount = 0;
|
||||
|
||||
private $riskyCount = 0;
|
||||
|
||||
private $skippedCount = 0;
|
||||
|
||||
private $startCount = 0;
|
||||
|
||||
public function addError(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->errorCount++;
|
||||
}
|
||||
|
||||
public function addWarning(Test $test, Warning $e, float $time): void
|
||||
{
|
||||
$this->warningCount++;
|
||||
}
|
||||
|
||||
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
|
||||
{
|
||||
$this->failureCount++;
|
||||
}
|
||||
|
||||
public function addIncompleteTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->notImplementedCount++;
|
||||
}
|
||||
|
||||
public function addRiskyTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->riskyCount++;
|
||||
}
|
||||
|
||||
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->skippedCount++;
|
||||
}
|
||||
|
||||
public function startTestSuite(TestSuite $suite): void
|
||||
{
|
||||
}
|
||||
|
||||
public function endTestSuite(TestSuite $suite): void
|
||||
{
|
||||
}
|
||||
|
||||
public function startTest(Test $test): void
|
||||
{
|
||||
$this->startCount++;
|
||||
}
|
||||
|
||||
public function endTest(Test $test, float $time): void
|
||||
{
|
||||
$this->endCount++;
|
||||
}
|
||||
|
||||
public function endCount(): int
|
||||
{
|
||||
return $this->endCount;
|
||||
}
|
||||
|
||||
public function errorCount(): int
|
||||
{
|
||||
return $this->errorCount;
|
||||
}
|
||||
|
||||
public function failureCount(): int
|
||||
{
|
||||
return $this->failureCount;
|
||||
}
|
||||
|
||||
public function warningCount(): int
|
||||
{
|
||||
return $this->warningCount;
|
||||
}
|
||||
|
||||
public function notImplementedCount(): int
|
||||
{
|
||||
return $this->notImplementedCount;
|
||||
}
|
||||
|
||||
public function riskyCount(): int
|
||||
{
|
||||
return $this->riskyCount;
|
||||
}
|
||||
|
||||
public function skippedCount(): int
|
||||
{
|
||||
return $this->skippedCount;
|
||||
}
|
||||
|
||||
public function startCount(): int
|
||||
{
|
||||
return $this->startCount;
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ final class NamedConstraint extends Constraint
|
||||
|
||||
public static function fromName(string $name): self
|
||||
{
|
||||
$instance = new self();
|
||||
$instance = new self;
|
||||
|
||||
$instance->name = $name;
|
||||
|
||||
|
||||
29
vendor/phpunit/phpunit/tests/_files/NotSelfDescribingTest.php
vendored
Normal file
29
vendor/phpunit/phpunit/tests/_files/NotSelfDescribingTest.php
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
use PHPUnit\Framework\Test;
|
||||
use PHPUnit\Framework\TestResult;
|
||||
|
||||
class NotSelfDescribingTest implements Test
|
||||
{
|
||||
public function log($msg): void
|
||||
{
|
||||
print $msg;
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function run(TestResult $result = null): TestResult
|
||||
{
|
||||
return new TestResult();
|
||||
}
|
||||
}
|
||||
@@ -8,11 +8,12 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\Warning;
|
||||
|
||||
class TestWarning extends TestCase
|
||||
{
|
||||
protected function runTest(): void
|
||||
{
|
||||
throw new \PHPUnit\Framework\Warning();
|
||||
throw new Warning;
|
||||
}
|
||||
}
|
||||
|
||||
2
vendor/phpunit/phpunit/tests/bootstrap.php
vendored
2
vendor/phpunit/phpunit/tests/bootstrap.php
vendored
@@ -39,6 +39,8 @@ require_once TEST_FILES_PATH . 'NoTestCases.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'NotPublicTestCase.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'NotSelfDescribingTest.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'NotVoidTestCase.php';
|
||||
|
||||
require_once TEST_FILES_PATH . 'OverrideTestCase.php';
|
||||
|
||||
@@ -16,11 +16,12 @@ use PHPUnit\Runner\AfterSkippedTestHook;
|
||||
use PHPUnit\Runner\AfterSuccessfulTestHook;
|
||||
use PHPUnit\Runner\AfterTestErrorHook;
|
||||
use PHPUnit\Runner\AfterTestFailureHook;
|
||||
use PHPUnit\Runner\AfterTestHook;
|
||||
use PHPUnit\Runner\AfterTestWarningHook;
|
||||
use PHPUnit\Runner\BeforeFirstTestHook;
|
||||
use PHPUnit\Runner\BeforeTestHook;
|
||||
|
||||
final class Extension implements BeforeFirstTestHook, BeforeTestHook, AfterSuccessfulTestHook, AfterSkippedTestHook, AfterRiskyTestHook, AfterIncompleteTestHook, AfterTestErrorHook, AfterTestWarningHook, AfterTestFailureHook, AfterLastTestHook
|
||||
final class Extension implements BeforeFirstTestHook, BeforeTestHook, AfterTestHook, AfterSuccessfulTestHook, AfterSkippedTestHook, AfterRiskyTestHook, AfterIncompleteTestHook, AfterTestErrorHook, AfterTestWarningHook, AfterTestFailureHook, AfterLastTestHook
|
||||
{
|
||||
private $amountOfInjectedArguments = 0;
|
||||
|
||||
@@ -45,6 +46,11 @@ final class Extension implements BeforeFirstTestHook, BeforeTestHook, AfterSucce
|
||||
print __METHOD__ . ': ' . $test . \PHP_EOL;
|
||||
}
|
||||
|
||||
public function executeAfterTest(string $test, float $time): void
|
||||
{
|
||||
print __METHOD__ . ': ' . $test . \PHP_EOL;
|
||||
}
|
||||
|
||||
public function executeAfterSuccessfulTest(string $test, float $time): void
|
||||
{
|
||||
print __METHOD__ . ': ' . $test . \PHP_EOL;
|
||||
|
||||
@@ -26,4 +26,4 @@ Time: %s, Memory: %s
|
||||
|
||||
OK, but incomplete, skipped, or risky tests!
|
||||
Tests: 5, Assertions: 3, Skipped: 2.
|
||||
C:30:"PHPUnit\Runner\TestResultCache":%d:{a:2:{s:7:"defects";a:2:{s:8:"testFour";i:1;s:9:"testThree";i:1;}s:5:"times";a:5:{s:8:"testFive";d:%f;s:8:"testFour";d:%f;s:9:"testThree";d:%f;s:7:"testTwo";d:%f;s:7:"testOne";d:%f;}}}
|
||||
C:30:"PHPUnit\Runner\TestResultCache":%d:{a:2:{s:7:"defects";a:2:{s:29:"MultiDependencyTest::testFour";i:1;s:30:"MultiDependencyTest::testThree";i:1;}s:5:"times";a:5:{s:29:"MultiDependencyTest::testFive";d:%f;s:29:"MultiDependencyTest::testFour";d:%f;s:30:"MultiDependencyTest::testThree";d:%f;s:28:"MultiDependencyTest::testTwo";d:%f;s:28:"MultiDependencyTest::testOne";d:%f;}}}
|
||||
|
||||
@@ -17,6 +17,8 @@ DataProviderTestDox
|
||||
✔ Does something with data set "two"
|
||||
✔ Does something else with data set "one"
|
||||
✔ Does something else with data set "two"
|
||||
✔ With provider with indexed array with data set #0
|
||||
✔ With provider with indexed array with data set #1
|
||||
✔ ... true ...
|
||||
✔ ... 1 ...
|
||||
✔ ... 1.0 ...
|
||||
@@ -29,4 +31,4 @@ DataProviderTestDox
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (13 tests, 13 assertions)
|
||||
OK (15 tests, 15 assertions)
|
||||
|
||||
@@ -103,7 +103,7 @@ Configuration Options:
|
||||
--include-path <path(s)> Prepend PHP's include_path with given path(s)
|
||||
-d key[=value] Sets a php.ini value
|
||||
--generate-configuration Generate configuration file with suggested settings
|
||||
--cache-result-file==<FILE> Specify result cache path and filename
|
||||
--cache-result-file=<file> Specify result cache path and filename
|
||||
|
||||
Miscellaneous Options:
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ Configuration Options:
|
||||
--include-path <path(s)> Prepend PHP's include_path with given path(s)
|
||||
-d key[=value] Sets a php.ini value
|
||||
--generate-configuration Generate configuration file with suggested settings
|
||||
--cache-result-file==<FILE> Specify result cache path and filename
|
||||
--cache-result-file=<file> Specify result cache path and filename
|
||||
|
||||
Miscellaneous Options:
|
||||
|
||||
|
||||
@@ -16,16 +16,23 @@ PHPUnit\Test\Extension::tellAmountOfInjectedArguments: %d
|
||||
PHPUnit\Test\Extension::executeBeforeFirstTest
|
||||
PHPUnit\Test\Extension::executeBeforeTest: PHPUnit\Test\HookTest::testSuccess
|
||||
PHPUnit\Test\Extension::executeAfterSuccessfulTest: PHPUnit\Test\HookTest::testSuccess
|
||||
PHPUnit\Test\Extension::executeAfterTest: PHPUnit\Test\HookTest::testSuccess
|
||||
PHPUnit\Test\Extension::executeBeforeTest: PHPUnit\Test\HookTest::testFailure
|
||||
PHPUnit\Test\Extension::executeAfterTestFailure: PHPUnit\Test\HookTest::testFailure: Failed asserting that false is true.
|
||||
PHPUnit\Test\Extension::executeAfterTest: PHPUnit\Test\HookTest::testFailure
|
||||
PHPUnit\Test\Extension::executeBeforeTest: PHPUnit\Test\HookTest::testError
|
||||
PHPUnit\Test\Extension::executeAfterTestError: PHPUnit\Test\HookTest::testError: message
|
||||
PHPUnit\Test\Extension::executeAfterTest: PHPUnit\Test\HookTest::testError
|
||||
PHPUnit\Test\Extension::executeBeforeTest: PHPUnit\Test\HookTest::testIncomplete
|
||||
PHPUnit\Test\Extension::executeAfterIncompleteTest: PHPUnit\Test\HookTest::testIncomplete: message
|
||||
PHPUnit\Test\Extension::executeAfterTest: PHPUnit\Test\HookTest::testIncomplete
|
||||
PHPUnit\Test\Extension::executeBeforeTest: PHPUnit\Test\HookTest::testRisky
|
||||
PHPUnit\Test\Extension::executeAfterRiskyTest: PHPUnit\Test\HookTest::testRisky: message
|
||||
PHPUnit\Test\Extension::executeAfterTest: PHPUnit\Test\HookTest::testRisky
|
||||
PHPUnit\Test\Extension::executeBeforeTest: PHPUnit\Test\HookTest::testSkipped
|
||||
PHPUnit\Test\Extension::executeAfterSkippedTest: PHPUnit\Test\HookTest::testSkipped: message
|
||||
PHPUnit\Test\Extension::executeAfterTest: PHPUnit\Test\HookTest::testSkipped
|
||||
PHPUnit\Test\Extension::executeBeforeTest: PHPUnit\Test\HookTest::testWarning
|
||||
PHPUnit\Test\Extension::executeAfterTestWarning: PHPUnit\Test\HookTest::testWarning: message
|
||||
PHPUnit\Test\Extension::executeAfterTest: PHPUnit\Test\HookTest::testWarning
|
||||
PHPUnit\Test\Extension::executeAfterLastTest
|
||||
|
||||
28
vendor/phpunit/phpunit/tests/end-to-end/log-junit-phpt.phpt
vendored
Normal file
28
vendor/phpunit/phpunit/tests/end-to-end/log-junit-phpt.phpt
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
phpunit --log-junit php://stdout ../end-to-end/phpt-stderr.phpt
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--log-junit';
|
||||
$_SERVER['argv'][3] = 'php://stdout';
|
||||
$_SERVER['argv'][4] = \realpath(__DIR__ . '/../end-to-end/phpt-stderr.phpt');
|
||||
|
||||
require __DIR__ . '/../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
?>
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
. 1 / 1 (100%)<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuites>
|
||||
<testsuite name="" tests="1" assertions="1" errors="0" failures="0" skipped="0" time="%s">
|
||||
<testcase name="%send-to-end%ephpt-stderr.phpt" assertions="1" time="%s">
|
||||
<system-out>PHPUnit must look at STDERR when running PHPT tests.</system-out>
|
||||
</testcase>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
25
vendor/phpunit/phpunit/tests/end-to-end/log-teamcity-phpt.phpt
vendored
Normal file
25
vendor/phpunit/phpunit/tests/end-to-end/log-teamcity-phpt.phpt
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
--TEST--
|
||||
phpunit --log-teamcity php://stdout ../end-to-end/phpt-stderr.phpt
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--log-teamcity';
|
||||
$_SERVER['argv'][3] = 'php://stdout';
|
||||
$_SERVER['argv'][4] = \realpath(__DIR__ . '/../end-to-end/phpt-stderr.phpt');
|
||||
|
||||
require __DIR__ . '/../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
|
||||
##teamcity[testCount count='1' flowId='%d']
|
||||
|
||||
##teamcity[testStarted name='%send-to-end%ephpt-stderr.phpt' flowId='%d']
|
||||
. 1 / 1 (100%)
|
||||
##teamcity[testFinished name='%send-to-end%ephpt-stderr.phpt' duration='%d' flowId='%d']
|
||||
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK (1 test, 1 assertion)
|
||||
@@ -18,7 +18,7 @@ class Issue1351Test extends TestCase
|
||||
*/
|
||||
public function testFailurePre(): void
|
||||
{
|
||||
$this->instance = new ChildProcessClass1351();
|
||||
$this->instance = new ChildProcessClass1351;
|
||||
$this->assertFalse(true, 'Expected failure.');
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class Issue1351Test extends TestCase
|
||||
*/
|
||||
public function testExceptionPre(): void
|
||||
{
|
||||
$this->instance = new ChildProcessClass1351();
|
||||
$this->instance = new ChildProcessClass1351;
|
||||
|
||||
try {
|
||||
throw new LogicException('Expected exception.');
|
||||
|
||||
@@ -25,7 +25,7 @@ class Issue2137Test extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
return [
|
||||
//[true, true]
|
||||
new stdClass(), // not valid
|
||||
new stdClass, // not valid
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ Time: %s, Memory: %s
|
||||
|
||||
There was 1 error:
|
||||
|
||||
1) Issue2145Test
|
||||
1) Issue2145Test::testOne
|
||||
Exception in %s%eIssue2145Test.php:%d
|
||||
%A
|
||||
ERRORS!
|
||||
Tests: 2, Assertions: 0, Errors: 1.
|
||||
Tests: 1, Assertions: 0, Errors: 1.
|
||||
|
||||
@@ -5,6 +5,8 @@ Expected result is to have an error, because of no classes loaded.
|
||||
<?php
|
||||
if (!extension_loaded('xdebug')) {
|
||||
print 'skip: xdebug not loaded';
|
||||
} elseif (version_compare(PHP_VERSION, '7.3.0-dev', '>=')) {
|
||||
print 'skip: PHP < 7.3 required';
|
||||
}
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
*/
|
||||
class SeparateClassRunMethodInNewProcessTest extends PHPUnit\Framework\TestCase
|
||||
{
|
||||
const PROCESS_ID_FILE_PATH = __DIR__ . '/parent_process_id.txt';
|
||||
public const PROCESS_ID_FILE_PATH = __DIR__ . '/parent_process_id.txt';
|
||||
|
||||
const INITIAL_MASTER_PID = 0;
|
||||
public const INITIAL_MASTER_PID = 0;
|
||||
|
||||
const INITIAL_PID1 = 1;
|
||||
public const INITIAL_PID1 = 1;
|
||||
|
||||
public static $masterPid = self::INITIAL_MASTER_PID;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ use PHPUnit\Framework\TestCase;
|
||||
*/
|
||||
class BeforeAfterClassPidTest extends TestCase
|
||||
{
|
||||
const PID_VARIABLE = 'current_pid';
|
||||
public const PID_VARIABLE = 'current_pid';
|
||||
|
||||
/**
|
||||
* @beforeClass
|
||||
|
||||
@@ -12,8 +12,8 @@ PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
Issue3107\Issue3107Test
|
||||
✘ Error bootstapping suite (most likely in Issue3107\Issue3107Test::setUpBeforeClass)
|
||||
Issue3107\Issue3107
|
||||
✘ One
|
||||
│
|
||||
│ Error: Call to undefined function %Sdoes_not_exist()
|
||||
│
|
||||
|
||||
@@ -19,7 +19,7 @@ class Issue3156Test extends TestCase
|
||||
{
|
||||
$this->assertStringEndsWith('/', '/');
|
||||
|
||||
return new stdClass();
|
||||
return new stdClass;
|
||||
}
|
||||
|
||||
public function dataSelectOperatorsProvider(): array
|
||||
|
||||
58
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3364/issue-3364-test.phpt
vendored
Normal file
58
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3364/issue-3364-test.phpt
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/3364
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--teamcity';
|
||||
$_SERVER['argv'][3] = __DIR__ . DIRECTORY_SEPARATOR . 'tests';
|
||||
|
||||
require __DIR__ . '/../../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
|
||||
##teamcity[testCount count='4' flowId='%d']
|
||||
|
||||
##teamcity[testSuiteStarted name='%stests%eend-to-end%eregression%eGitHub%e3364%etests' flowId='%d']
|
||||
|
||||
##teamcity[testSuiteStarted name='Issue3364SetupBeforeClassTest' locationHint='php_qn://%s%etests%eend-to-end%eregression%eGitHub%e3364%etests%eIssue3364SetupBeforeClassTest.php::\Issue3364SetupBeforeClassTest' flowId='%d']
|
||||
|
||||
##teamcity[testStarted name='testOneWithClassSetupException' locationHint='php_qn://%s%etests%eend-to-end%eregression%eGitHub%e3364%etests%eIssue3364SetupBeforeClassTest.php::\Issue3364SetupBeforeClassTest::testOneWithClassSetupException' flowId='%d']
|
||||
|
||||
##teamcity[testFailed name='testOneWithClassSetupException' message='throw exception in setUpBeforeClass' details=' %s%etests%eend-to-end%eregression%eGitHub%e3364%etests%eIssue3364SetupBeforeClassTest.php:18|n ' duration='%d' flowId='%d']
|
||||
|
||||
##teamcity[testFinished name='testOneWithClassSetupException' duration='%d' flowId='%d']
|
||||
|
||||
##teamcity[testStarted name='testTwoWithClassSetupException' locationHint='php_qn://%s%etests%eend-to-end%eregression%eGitHub%e3364%etests%eIssue3364SetupBeforeClassTest.php::\Issue3364SetupBeforeClassTest::testTwoWithClassSetupException' flowId='%d']
|
||||
|
||||
##teamcity[testFailed name='testTwoWithClassSetupException' message='throw exception in setUpBeforeClass' details=' %s%etests%eend-to-end%eregression%eGitHub%e3364%etests%eIssue3364SetupBeforeClassTest.php:18|n ' duration='%d' flowId='%d']
|
||||
|
||||
##teamcity[testFinished name='testTwoWithClassSetupException' duration='%d' flowId='%d']
|
||||
|
||||
##teamcity[testSuiteFinished name='Issue3364SetupBeforeClassTest' flowId='%d']
|
||||
|
||||
##teamcity[testSuiteStarted name='Issue3364SetupTest' locationHint='php_qn://%s%etests%eend-to-end%eregression%eGitHub%e3364%etests%eIssue3364SetupTest.php::\Issue3364SetupTest' flowId='%d']
|
||||
|
||||
##teamcity[testStarted name='testOneWithSetupException' locationHint='php_qn://%s%etests%eend-to-end%eregression%eGitHub%e3364%etests%eIssue3364SetupTest.php::\Issue3364SetupTest::testOneWithSetupException' flowId='%d']
|
||||
|
||||
##teamcity[testFailed name='testOneWithSetupException' message='RuntimeException : throw exception in setUp' details=' %s%etests%eend-to-end%eregression%eGitHub%e3364%etests%eIssue3364SetupTest.php:18|n ' duration='%d' flowId='%d']
|
||||
|
||||
##teamcity[testFinished name='testOneWithSetupException' duration='%d' flowId='%d']
|
||||
|
||||
##teamcity[testStarted name='testTwoWithSetupException' locationHint='php_qn://%s%etests%eend-to-end%eregression%eGitHub%e3364%etests%eIssue3364SetupTest.php::\Issue3364SetupTest::testTwoWithSetupException' flowId='%d']
|
||||
|
||||
##teamcity[testFailed name='testTwoWithSetupException' message='RuntimeException : throw exception in setUp' details=' %s%etests%eend-to-end%eregression%eGitHub%e3364%etests%eIssue3364SetupTest.php:18|n ' duration='%d' flowId='%d']
|
||||
|
||||
##teamcity[testFinished name='testTwoWithSetupException' duration='%d' flowId='%d']
|
||||
|
||||
##teamcity[testSuiteFinished name='Issue3364SetupTest' flowId='%d']
|
||||
|
||||
##teamcity[testSuiteFinished name='%stests%eend-to-end%eregression%eGitHub%e3364%etests' flowId='%d']
|
||||
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
|
||||
ERRORS!
|
||||
Tests: 4, Assertions: 0, Errors: 4.
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class Issue3364SetupBeforeClassTest extends TestCase
|
||||
{
|
||||
public static function setUpBeforeClass(): void
|
||||
{
|
||||
throw new \RuntimeException('throw exception in setUpBeforeClass');
|
||||
}
|
||||
|
||||
public function testOneWithClassSetupException(): void
|
||||
{
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testTwoWithClassSetupException(): void
|
||||
{
|
||||
$this->fail();
|
||||
}
|
||||
}
|
||||
30
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3364/tests/Issue3364SetupTest.php
vendored
Normal file
30
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3364/tests/Issue3364SetupTest.php
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class Issue3364SetupTest extends TestCase
|
||||
{
|
||||
public function setUp(): void
|
||||
{
|
||||
throw new \RuntimeException('throw exception in setUp');
|
||||
}
|
||||
|
||||
public function testOneWithSetupException(): void
|
||||
{
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testTwoWithSetupException(): void
|
||||
{
|
||||
$this->fail();
|
||||
}
|
||||
}
|
||||
20
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379.phpt
vendored
Normal file
20
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379.phpt
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
GH-3379: Dependent test of skipped test has status -1
|
||||
--FILE--
|
||||
<?php
|
||||
$_SERVER['argv'][1] = '--configuration';
|
||||
$_SERVER['argv'][2] = __DIR__ . '/3379/';
|
||||
|
||||
require __DIR__ . '/../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
Skipped test testOne, status: 1
|
||||
SSkipped test testTwo, status: 1
|
||||
S 2 / 2 (100%)
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
OK, but incomplete, skipped, or risky tests!
|
||||
Tests: 2, Assertions: 0, Skipped: 2.
|
||||
28
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379/Issue3379Test.php
vendored
Normal file
28
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379/Issue3379Test.php
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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 Test;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class Issue3379Test extends TestCase
|
||||
{
|
||||
public function testOne(): void
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testOne
|
||||
*/
|
||||
public function testTwo(): void
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
26
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379/Issue3379TestListener.php
vendored
Normal file
26
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379/Issue3379TestListener.php
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
use PHPUnit\Framework\Test;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use PHPUnit\Framework\TestListener;
|
||||
use PHPUnit\Framework\TestListenerDefaultImplementation;
|
||||
|
||||
class Issue3379TestListener implements TestListener
|
||||
{
|
||||
use TestListenerDefaultImplementation;
|
||||
|
||||
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
if ($test instanceof TestCase) {
|
||||
print 'Skipped test ' . $test->getName() . ', status: ' . $test->getStatus() . \PHP_EOL;
|
||||
}
|
||||
}
|
||||
}
|
||||
13
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379/phpunit.xml
vendored
Normal file
13
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3379/phpunit.xml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.4/phpunit.xsd">
|
||||
<testsuites>
|
||||
<testsuite name="default">
|
||||
<directory suffix="Test.php">.</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<listeners>
|
||||
<listener class="Issue3379TestListener" file="./Issue3379TestListener.php"/>
|
||||
</listeners>
|
||||
</phpunit>
|
||||
63
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3380/issue-3380-test.phpt
vendored
Normal file
63
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3380/issue-3380-test.phpt
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/3380
|
||||
--FILE--
|
||||
<?php
|
||||
$tmpResultCache = tempnam(sys_get_temp_dir(), __FILE__);
|
||||
file_put_contents($tmpResultCache, file_get_contents(__DIR__ . '/../../../../_files/DataproviderExecutionOrderTest_result_cache.txt'));
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--order-by=defects';
|
||||
$_SERVER['argv'][3] = '--testdox';
|
||||
$_SERVER['argv'][4] = '--cache-result';
|
||||
$_SERVER['argv'][5] = '--cache-result-file=' . $tmpResultCache;
|
||||
$_SERVER['argv'][6] = \dirname(\dirname(\dirname(__DIR__))) . '/../_files/DataproviderExecutionOrderTest.php';
|
||||
|
||||
require __DIR__ . '/../../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
|
||||
unlink($tmpResultCache);
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
DataproviderExecutionOrder
|
||||
✔ First test that always works
|
||||
✔ Add numbers with a dataprovider with data set "1+2=3"
|
||||
✔ Add numbers with a dataprovider with data set "2+1=3"
|
||||
✘ Add numbers with a dataprovider with data set "1+1=3"
|
||||
│
|
||||
│ Failed asserting that 2 is identical to 3.
|
||||
│%w
|
||||
│ %s%etests%e_files%eDataproviderExecutionOrderTest.php:%d
|
||||
│%w
|
||||
|
||||
✔ Test in the middle that always works
|
||||
✔ Add more numbers with a dataprovider with data set "1+2=3"
|
||||
✔ Add more numbers with a dataprovider with data set "2+1=3"
|
||||
✘ Add more numbers with a dataprovider with data set "1+1=3"
|
||||
│
|
||||
│ Failed asserting that 2 is identical to 3.
|
||||
│%w
|
||||
│ %s%etests%e_files%eDataproviderExecutionOrderTest.php:%d
|
||||
│%w
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
Summary of non-successful tests:
|
||||
|
||||
DataproviderExecutionOrder
|
||||
✘ Add numbers with a dataprovider with data set "1+1=3"
|
||||
│
|
||||
│ Failed asserting that 2 is identical to 3.
|
||||
│%w
|
||||
│ %s%etests%e_files%eDataproviderExecutionOrderTest.php:%d
|
||||
│%w
|
||||
|
||||
✘ Add more numbers with a dataprovider with data set "1+1=3"
|
||||
│
|
||||
│ Failed asserting that 2 is identical to 3.
|
||||
│%w
|
||||
│ %s%etests%e_files%eDataproviderExecutionOrderTest.php:%d
|
||||
│%w
|
||||
|
||||
FAILURES!
|
||||
Tests: 8, Assertions: 8, Failures: 2.
|
||||
55
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3396/issue-3396-test.phpt
vendored
Normal file
55
vendor/phpunit/phpunit/tests/end-to-end/regression/GitHub/3396/issue-3396-test.phpt
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
--TEST--
|
||||
https://github.com/sebastianbergmann/phpunit/issues/3396
|
||||
--FILE--
|
||||
<?php
|
||||
$tmpResultCache = tempnam(sys_get_temp_dir(), __FILE__);
|
||||
file_put_contents($tmpResultCache, file_get_contents(__DIR__ . '/../../../../_files/DataproviderExecutionOrderTest_result_cache.txt'));
|
||||
|
||||
$_SERVER['argv'][1] = '--no-configuration';
|
||||
$_SERVER['argv'][2] = '--order-by=defects';
|
||||
$_SERVER['argv'][3] = '--debug';
|
||||
$_SERVER['argv'][4] = '--cache-result';
|
||||
$_SERVER['argv'][5] = '--cache-result-file=' . $tmpResultCache;
|
||||
$_SERVER['argv'][6] = \dirname(\dirname(\dirname(__DIR__))) . '/../_files/DataproviderExecutionOrderTest.php';
|
||||
|
||||
require __DIR__ . '/../../../../bootstrap.php';
|
||||
PHPUnit\TextUI\Command::main();
|
||||
|
||||
unlink($tmpResultCache);
|
||||
--EXPECTF--
|
||||
PHPUnit %s by Sebastian Bergmann and contributors.
|
||||
|
||||
Test 'DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+1=3" (1, 1, 3)' started
|
||||
Test 'DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+1=3" (1, 1, 3)' ended
|
||||
Test 'DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+2=3" (1, 2, 3)' started
|
||||
Test 'DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+2=3" (1, 2, 3)' ended
|
||||
Test 'DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "2+1=3" (2, 1, 3)' started
|
||||
Test 'DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "2+1=3" (2, 1, 3)' ended
|
||||
Test 'DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+1=3" (1, 1, 3)' started
|
||||
Test 'DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+1=3" (1, 1, 3)' ended
|
||||
Test 'DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+2=3" (1, 2, 3)' started
|
||||
Test 'DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+2=3" (1, 2, 3)' ended
|
||||
Test 'DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "2+1=3" (2, 1, 3)' started
|
||||
Test 'DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "2+1=3" (2, 1, 3)' ended
|
||||
Test 'DataproviderExecutionOrderTest::testFirstTestThatAlwaysWorks' started
|
||||
Test 'DataproviderExecutionOrderTest::testFirstTestThatAlwaysWorks' ended
|
||||
Test 'DataproviderExecutionOrderTest::testTestInTheMiddleThatAlwaysWorks' started
|
||||
Test 'DataproviderExecutionOrderTest::testTestInTheMiddleThatAlwaysWorks' ended
|
||||
|
||||
|
||||
Time: %s, Memory: %s
|
||||
|
||||
There were 2 failures:
|
||||
|
||||
1) DataproviderExecutionOrderTest::testAddNumbersWithADataprovider with data set "1+1=3" (1, 1, 3)
|
||||
Failed asserting that 2 is identical to 3.
|
||||
|
||||
%s%etests%e_files%eDataproviderExecutionOrderTest.php:%d
|
||||
|
||||
2) DataproviderExecutionOrderTest::testAddMoreNumbersWithADataprovider with data set "1+1=3" (1, 1, 3)
|
||||
Failed asserting that 2 is identical to 3.
|
||||
|
||||
%s%etests%e_files%eDataproviderExecutionOrderTest.php:%d
|
||||
|
||||
FAILURES!
|
||||
Tests: 8, Assertions: 8, Failures: 2.
|
||||
@@ -13,7 +13,7 @@ class Issue523Test extends TestCase
|
||||
{
|
||||
public function testAttributeEquals(): void
|
||||
{
|
||||
$this->assertAttributeEquals('foo', 'field', new Issue523());
|
||||
$this->assertAttributeEquals('foo', 'field', new Issue523);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ class AssertTest extends TestCase
|
||||
$test = [new \Book, new \Book];
|
||||
|
||||
$this->assertContainsOnlyInstancesOf(\Book::class, $test);
|
||||
$this->assertContainsOnlyInstancesOf(\stdClass::class, [new \stdClass()]);
|
||||
$this->assertContainsOnlyInstancesOf(\stdClass::class, [new \stdClass]);
|
||||
|
||||
$test2 = [new \Author('Test')];
|
||||
|
||||
@@ -113,6 +113,20 @@ class AssertTest extends TestCase
|
||||
$this->assertContains('', 'test');
|
||||
}
|
||||
|
||||
public function testAssertStringContainsNonString(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
|
||||
$this->assertContains(null, '');
|
||||
}
|
||||
|
||||
public function testAssertStringNotContainsNonString(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
|
||||
$this->assertNotContains(null, '');
|
||||
}
|
||||
|
||||
public function testAssertArrayHasKeyThrowsExceptionForInvalidFirstArgument(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
@@ -844,6 +858,8 @@ XML;
|
||||
|
||||
public function testAssertNotIsReadable(): void
|
||||
{
|
||||
$this->assertNotIsReadable(__DIR__ . \DIRECTORY_SEPARATOR . 'NotExisting');
|
||||
|
||||
$this->expectException(AssertionFailedError::class);
|
||||
|
||||
$this->assertNotIsReadable(__FILE__);
|
||||
@@ -860,6 +876,8 @@ XML;
|
||||
|
||||
public function testAssertNotIsWritable(): void
|
||||
{
|
||||
$this->assertNotIsWritable(__DIR__ . \DIRECTORY_SEPARATOR . 'NotExisting');
|
||||
|
||||
$this->expectException(AssertionFailedError::class);
|
||||
|
||||
$this->assertNotIsWritable(__FILE__);
|
||||
@@ -1582,6 +1600,13 @@ XML;
|
||||
$this->assertClassHasAttribute('1', \ClassWithNonPublicAttributes::class);
|
||||
}
|
||||
|
||||
public function testAssertClassHasAttributeThrowsExceptionIfClassDoesNotExist(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
|
||||
$this->assertClassHasAttribute('attribute', 'ClassThatDoesNotExist');
|
||||
}
|
||||
|
||||
public function testAssertClassNotHasAttributeThrowsExceptionIfAttributeNameIsNotValid(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
@@ -1589,6 +1614,13 @@ XML;
|
||||
$this->assertClassNotHasAttribute('1', \ClassWithNonPublicAttributes::class);
|
||||
}
|
||||
|
||||
public function testAssertClassNotHasAttributeThrowsExceptionIfClassDoesNotExist(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
|
||||
$this->assertClassNotHasAttribute('attribute', 'ClassThatDoesNotExist');
|
||||
}
|
||||
|
||||
public function testAssertClassHasStaticAttributeThrowsExceptionIfAttributeNameIsNotValid(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
@@ -1596,6 +1628,13 @@ XML;
|
||||
$this->assertClassHasStaticAttribute('1', \ClassWithNonPublicAttributes::class);
|
||||
}
|
||||
|
||||
public function testAssertClassHasStaticAttributeThrowsExceptionIfClassDoesNotExist(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
|
||||
$this->assertClassHasStaticAttribute('attribute', 'ClassThatDoesNotExist');
|
||||
}
|
||||
|
||||
public function testAssertClassNotHasStaticAttributeThrowsExceptionIfAttributeNameIsNotValid(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
@@ -1603,6 +1642,13 @@ XML;
|
||||
$this->assertClassNotHasStaticAttribute('1', \ClassWithNonPublicAttributes::class);
|
||||
}
|
||||
|
||||
public function testAssertClassNotHasStaticAttributeThrowsExceptionIfClassDoesNotExist(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
|
||||
$this->assertClassNotHasStaticAttribute('attribute', 'ClassThatDoesNotExist');
|
||||
}
|
||||
|
||||
public function testAssertObjectHasAttributeThrowsException2(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
@@ -2397,6 +2443,13 @@ XML;
|
||||
$this->assertJsonFileEqualsJsonFile($file, $file, $message);
|
||||
}
|
||||
|
||||
public function testAssertInstanceOfThrowsExceptionIfTypeDoesNotExist(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
|
||||
$this->assertInstanceOf('ClassThatDoesNotExist', new \stdClass);
|
||||
}
|
||||
|
||||
public function testAssertInstanceOf(): void
|
||||
{
|
||||
$this->assertInstanceOf(\stdClass::class, new \stdClass);
|
||||
@@ -2414,6 +2467,13 @@ XML;
|
||||
$this->assertAttributeInstanceOf(\stdClass::class, 'a', $o);
|
||||
}
|
||||
|
||||
public function testAssertNotInstanceOfThrowsExceptionIfTypeDoesNotExist(): void
|
||||
{
|
||||
$this->expectException(Exception::class);
|
||||
|
||||
$this->assertNotInstanceOf('ClassThatDoesNotExist', new \stdClass);
|
||||
}
|
||||
|
||||
public function testAssertNotInstanceOf(): void
|
||||
{
|
||||
$this->assertNotInstanceOf(\Exception::class, new \stdClass);
|
||||
@@ -2506,6 +2566,444 @@ XML;
|
||||
$this->assertStringNotMatchesFormatFile(TEST_FILES_PATH . 'expectedFileFormat.txt', "FOO\n");
|
||||
}
|
||||
|
||||
public function testStringsCanBeComparedForEqualityIgnoringCase(): void
|
||||
{
|
||||
$this->assertEqualsIgnoringCase('a', 'A');
|
||||
|
||||
$this->assertNotEqualsIgnoringCase('a', 'B');
|
||||
}
|
||||
|
||||
public function testArraysOfStringsCanBeComparedForEqualityIgnoringCase(): void
|
||||
{
|
||||
$this->assertEqualsIgnoringCase(['a'], ['A']);
|
||||
|
||||
$this->assertNotEqualsIgnoringCase(['a'], ['B']);
|
||||
}
|
||||
|
||||
public function testStringsCanBeComparedForEqualityWithDelta(): void
|
||||
{
|
||||
$this->assertEqualsWithDelta(2.3, 2.5, 0.5);
|
||||
|
||||
$this->assertNotEqualsWithDelta(2.3, 3.5, 0.5);
|
||||
}
|
||||
|
||||
public function testArraysOfStringsCanBeComparedForEqualityWithDelta(): void
|
||||
{
|
||||
$this->assertEqualsWithDelta([2.3], [2.5], 0.5);
|
||||
|
||||
$this->assertNotEqualsWithDelta([2.3], [3.5], 0.5);
|
||||
}
|
||||
|
||||
public function testArraysCanBeComparedForEqualityWithCanonicalization(): void
|
||||
{
|
||||
$this->assertEqualsCanonicalizing([3, 2, 1], [2, 3, 1]);
|
||||
|
||||
$this->assertNotEqualsCanonicalizing([3, 2, 1], [2, 3, 4]);
|
||||
}
|
||||
|
||||
public function testArrayTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsArray([]);
|
||||
|
||||
try {
|
||||
$this->assertIsArray(null);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testBoolTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsBool(true);
|
||||
|
||||
try {
|
||||
$this->assertIsBool(null);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testFloatTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsFloat(0.0);
|
||||
|
||||
try {
|
||||
$this->assertIsFloat(null);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testIntTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsInt(1);
|
||||
|
||||
try {
|
||||
$this->assertIsInt(null);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNumericTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNumeric('1.0');
|
||||
|
||||
try {
|
||||
$this->assertIsNumeric('abc');
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testObjectTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsObject(new \stdClass);
|
||||
|
||||
try {
|
||||
$this->assertIsObject(null);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testResourceTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsResource(\fopen(__FILE__, 'r'));
|
||||
|
||||
try {
|
||||
$this->assertIsResource(null);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testStringTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsString('');
|
||||
|
||||
try {
|
||||
$this->assertIsString(null);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testScalarTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsScalar(true);
|
||||
|
||||
try {
|
||||
$this->assertIsScalar(new \stdClass);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testCallableTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsCallable(function () {
|
||||
});
|
||||
|
||||
try {
|
||||
$this->assertIsCallable(null);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testIterableTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsIterable([]);
|
||||
|
||||
try {
|
||||
$this->assertIsIterable(null);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotArrayTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotArray(null);
|
||||
|
||||
try {
|
||||
$this->assertIsNotArray([]);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotBoolTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotBool(null);
|
||||
|
||||
try {
|
||||
$this->assertIsNotBool(true);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotFloatTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotFloat(null);
|
||||
|
||||
try {
|
||||
$this->assertIsNotFloat(0.0);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotIntTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotInt(null);
|
||||
|
||||
try {
|
||||
$this->assertIsNotInt(1);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotNumericTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotNumeric('abc');
|
||||
|
||||
try {
|
||||
$this->assertIsNotNumeric('1.0');
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotObjectTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotObject(null);
|
||||
|
||||
try {
|
||||
$this->assertIsNotObject(new \stdClass);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotResourceTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotResource(null);
|
||||
|
||||
try {
|
||||
$this->assertIsNotResource(\fopen(__FILE__, 'r'));
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotScalarTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotScalar(new \stdClass);
|
||||
|
||||
try {
|
||||
$this->assertIsNotScalar(true);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotStringTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotString(null);
|
||||
|
||||
try {
|
||||
$this->assertIsNotString('');
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotCallableTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotCallable(null);
|
||||
|
||||
try {
|
||||
$this->assertIsNotCallable(function () {
|
||||
});
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testNotIterableTypeCanBeAsserted(): void
|
||||
{
|
||||
$this->assertIsNotIterable(null);
|
||||
|
||||
try {
|
||||
$this->assertIsNotIterable([]);
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testLogicalAnd(): void
|
||||
{
|
||||
$this->assertThat(
|
||||
true,
|
||||
$this->logicalAnd(
|
||||
$this->isTrue(),
|
||||
$this->isTrue()
|
||||
)
|
||||
);
|
||||
|
||||
$this->expectException(AssertionFailedError::class);
|
||||
|
||||
$this->assertThat(
|
||||
true,
|
||||
$this->logicalAnd(
|
||||
$this->isTrue(),
|
||||
$this->isFalse()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testLogicalOr(): void
|
||||
{
|
||||
$this->assertThat(
|
||||
true,
|
||||
$this->logicalOr(
|
||||
$this->isTrue(),
|
||||
$this->isFalse()
|
||||
)
|
||||
);
|
||||
|
||||
$this->expectException(AssertionFailedError::class);
|
||||
|
||||
$this->assertThat(
|
||||
true,
|
||||
$this->logicalOr(
|
||||
$this->isFalse(),
|
||||
$this->isFalse()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testLogicalXor(): void
|
||||
{
|
||||
$this->assertThat(
|
||||
true,
|
||||
$this->logicalXor(
|
||||
$this->isTrue(),
|
||||
$this->isFalse()
|
||||
)
|
||||
);
|
||||
|
||||
$this->expectException(AssertionFailedError::class);
|
||||
|
||||
$this->assertThat(
|
||||
true,
|
||||
$this->logicalXor(
|
||||
$this->isTrue(),
|
||||
$this->isTrue()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function testStringContainsStringCanBeAsserted(): void
|
||||
{
|
||||
$this->assertStringContainsString('bar', 'foobarbaz');
|
||||
|
||||
try {
|
||||
$this->assertStringContainsString('barbara', 'foobarbaz');
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testStringNotContainsStringCanBeAsserted(): void
|
||||
{
|
||||
$this->assertStringNotContainsString('barbara', 'foobarbaz');
|
||||
|
||||
try {
|
||||
$this->assertStringNotContainsString('bar', 'foobarbaz');
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testStringContainsStringCanBeAssertedIgnoringCase(): void
|
||||
{
|
||||
$this->assertStringContainsStringIgnoringCase('BAR', 'foobarbaz');
|
||||
|
||||
try {
|
||||
$this->assertStringContainsStringIgnoringCase('BARBARA', 'foobarbaz');
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
public function testStringNotContainsStringCanBeAssertedIgnoringCase(): void
|
||||
{
|
||||
$this->assertStringNotContainsStringIgnoringCase('BARBARA', 'foobarbaz');
|
||||
|
||||
try {
|
||||
$this->assertStringNotContainsStringIgnoringCase('BAR', 'foobarbaz');
|
||||
} catch (AssertionFailedError $e) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->fail();
|
||||
}
|
||||
|
||||
protected function sameValues(): array
|
||||
{
|
||||
$object = new \SampleClass(4, 8, 15);
|
||||
|
||||
@@ -16,7 +16,7 @@ class DirectoryExistsTest extends ConstraintTestCase
|
||||
{
|
||||
public function testDefaults(): void
|
||||
{
|
||||
$constraint = new DirectoryExists();
|
||||
$constraint = new DirectoryExists;
|
||||
|
||||
$this->assertCount(1, $constraint);
|
||||
$this->assertSame('directory exists', $constraint->toString());
|
||||
@@ -26,7 +26,7 @@ class DirectoryExistsTest extends ConstraintTestCase
|
||||
{
|
||||
$directory = __DIR__ . '/NonExistentDirectory';
|
||||
|
||||
$constraint = new DirectoryExists();
|
||||
$constraint = new DirectoryExists;
|
||||
|
||||
$this->assertFalse($constraint->evaluate($directory, '', true));
|
||||
}
|
||||
@@ -35,7 +35,7 @@ class DirectoryExistsTest extends ConstraintTestCase
|
||||
{
|
||||
$directory = __DIR__;
|
||||
|
||||
$constraint = new DirectoryExists();
|
||||
$constraint = new DirectoryExists;
|
||||
|
||||
$this->assertTrue($constraint->evaluate($directory, '', true));
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class DirectoryExistsTest extends ConstraintTestCase
|
||||
{
|
||||
$directory = __DIR__ . '/NonExistentDirectory';
|
||||
|
||||
$constraint = new DirectoryExists();
|
||||
$constraint = new DirectoryExists;
|
||||
|
||||
try {
|
||||
$constraint->evaluate($directory);
|
||||
|
||||
@@ -16,7 +16,7 @@ class FileExistsTest extends ConstraintTestCase
|
||||
{
|
||||
public function testConstraintFileExists(): void
|
||||
{
|
||||
$constraint = new FileExists();
|
||||
$constraint = new FileExists;
|
||||
|
||||
$this->assertFalse($constraint->evaluate('foo', '', true));
|
||||
$this->assertEquals('file exists', $constraint->toString());
|
||||
@@ -42,7 +42,7 @@ EOF
|
||||
|
||||
public function testConstraintFileExists2(): void
|
||||
{
|
||||
$constraint = new FileExists();
|
||||
$constraint = new FileExists;
|
||||
|
||||
try {
|
||||
$constraint->evaluate('foo', 'custom message');
|
||||
|
||||
@@ -16,7 +16,7 @@ class IsEmptyTest extends ConstraintTestCase
|
||||
{
|
||||
public function testConstraintIsEmpty(): void
|
||||
{
|
||||
$constraint = new IsEmpty();
|
||||
$constraint = new IsEmpty;
|
||||
|
||||
$this->assertFalse($constraint->evaluate(['foo'], '', true));
|
||||
$this->assertTrue($constraint->evaluate([], '', true));
|
||||
@@ -45,7 +45,7 @@ EOF
|
||||
|
||||
public function testConstraintIsEmpty2(): void
|
||||
{
|
||||
$constraint = new IsEmpty();
|
||||
$constraint = new IsEmpty;
|
||||
|
||||
try {
|
||||
$constraint->evaluate(['foo'], 'custom message');
|
||||
|
||||
@@ -16,7 +16,7 @@ class IsNullTest extends ConstraintTestCase
|
||||
{
|
||||
public function testConstraintIsNull(): void
|
||||
{
|
||||
$constraint = new IsNull();
|
||||
$constraint = new IsNull;
|
||||
|
||||
$this->assertFalse($constraint->evaluate(0, '', true));
|
||||
$this->assertTrue($constraint->evaluate(null, '', true));
|
||||
@@ -43,7 +43,7 @@ EOF
|
||||
|
||||
public function testConstraintIsNull2(): void
|
||||
{
|
||||
$constraint = new IsNull();
|
||||
$constraint = new IsNull;
|
||||
|
||||
try {
|
||||
$constraint->evaluate(0, 'custom message');
|
||||
|
||||
@@ -16,7 +16,7 @@ class IsReadableTest extends ConstraintTestCase
|
||||
{
|
||||
public function testConstraintIsReadable(): void
|
||||
{
|
||||
$constraint = new IsReadable();
|
||||
$constraint = new IsReadable;
|
||||
|
||||
$this->assertFalse($constraint->evaluate('foo', '', true));
|
||||
$this->assertEquals('is readable', $constraint->toString());
|
||||
|
||||
@@ -16,7 +16,7 @@ class IsWritableTest extends ConstraintTestCase
|
||||
{
|
||||
public function testConstraintIsWritable(): void
|
||||
{
|
||||
$constraint = new IsWritable();
|
||||
$constraint = new IsWritable;
|
||||
|
||||
$this->assertFalse($constraint->evaluate('foo', '', true));
|
||||
$this->assertEquals('is writable', $constraint->toString());
|
||||
|
||||
@@ -18,12 +18,12 @@ final class LogicalAndTest extends ConstraintTestCase
|
||||
public function testSetConstraintsRejectsInvalidConstraint(): void
|
||||
{
|
||||
$constraints = [
|
||||
new \TruthyConstraint(),
|
||||
new \FalsyConstraint(),
|
||||
new \stdClass(),
|
||||
new \TruthyConstraint,
|
||||
new \FalsyConstraint,
|
||||
new \stdClass,
|
||||
];
|
||||
|
||||
$constraint = new LogicalAnd();
|
||||
$constraint = new LogicalAnd;
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage(\sprintf(
|
||||
@@ -46,7 +46,7 @@ final class LogicalAndTest extends ConstraintTestCase
|
||||
return \CountConstraint::fromCount($count);
|
||||
}, $counts);
|
||||
|
||||
$constraint = new LogicalAnd();
|
||||
$constraint = new LogicalAnd;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -67,7 +67,7 @@ final class LogicalAndTest extends ConstraintTestCase
|
||||
return \NamedConstraint::fromName($name);
|
||||
}, $names);
|
||||
|
||||
$constraint = new LogicalAnd();
|
||||
$constraint = new LogicalAnd;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -83,7 +83,7 @@ final class LogicalAndTest extends ConstraintTestCase
|
||||
*/
|
||||
public function testEvaluateReturnsFalseIfAnyOfTheComposedConstraintsEvaluateToFalse(array $constraints): void
|
||||
{
|
||||
$constraint = new LogicalAnd();
|
||||
$constraint = new LogicalAnd;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -97,7 +97,7 @@ final class LogicalAndTest extends ConstraintTestCase
|
||||
*/
|
||||
public function testEvaluateReturnsTrueIfAllOfTheComposedConstraintsEvaluateToTrue(array $constraints): void
|
||||
{
|
||||
$constraint = new LogicalAnd();
|
||||
$constraint = new LogicalAnd;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -113,7 +113,7 @@ final class LogicalAndTest extends ConstraintTestCase
|
||||
{
|
||||
$other = 'whatever';
|
||||
|
||||
$constraint = new LogicalAnd();
|
||||
$constraint = new LogicalAnd;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -145,7 +145,7 @@ EOF;
|
||||
$other = 'whatever';
|
||||
$customDescription = 'Not very happy about the results at this point in time, I have to admit!';
|
||||
|
||||
$constraint = new LogicalAnd();
|
||||
$constraint = new LogicalAnd;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -178,7 +178,7 @@ EOF;
|
||||
*/
|
||||
public function testEvaluateReturnsNothingIfAllOfTheComposedConstraintsEvaluateToTrue(array $constraints): void
|
||||
{
|
||||
$constraint = new LogicalAnd();
|
||||
$constraint = new LogicalAnd;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -189,12 +189,12 @@ EOF;
|
||||
{
|
||||
$values = [
|
||||
'single' => [
|
||||
new \FalsyConstraint(),
|
||||
new \FalsyConstraint,
|
||||
],
|
||||
'multiple' => [
|
||||
new \TruthyConstraint(),
|
||||
new \FalsyConstraint(),
|
||||
new \TruthyConstraint(),
|
||||
new \TruthyConstraint,
|
||||
new \FalsyConstraint,
|
||||
new \TruthyConstraint,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -209,12 +209,12 @@ EOF;
|
||||
{
|
||||
$values = [
|
||||
'single' => [
|
||||
new \TruthyConstraint(),
|
||||
new \TruthyConstraint,
|
||||
],
|
||||
'multiple' => [
|
||||
new \TruthyConstraint(),
|
||||
new \TruthyConstraint(),
|
||||
new \TruthyConstraint(),
|
||||
new \TruthyConstraint,
|
||||
new \TruthyConstraint,
|
||||
new \TruthyConstraint,
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@ final class LogicalOrTest extends ConstraintTestCase
|
||||
public function testSetConstraintsDecoratesNonConstraintWithIsEqual(): void
|
||||
{
|
||||
$constraints = [
|
||||
new \stdClass(),
|
||||
new \stdClass,
|
||||
];
|
||||
|
||||
$constraint = new LogicalOr();
|
||||
$constraint = new LogicalOr;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
$this->assertTrue($constraint->evaluate(new \stdClass(), '', true));
|
||||
$this->assertTrue($constraint->evaluate(new \stdClass, '', true));
|
||||
}
|
||||
|
||||
public function testCountReturnsCountOfComposedConstraints(): void
|
||||
@@ -39,7 +39,7 @@ final class LogicalOrTest extends ConstraintTestCase
|
||||
return \CountConstraint::fromCount($count);
|
||||
}, $counts);
|
||||
|
||||
$constraint = new LogicalOr();
|
||||
$constraint = new LogicalOr;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -60,7 +60,7 @@ final class LogicalOrTest extends ConstraintTestCase
|
||||
return \NamedConstraint::fromName($name);
|
||||
}, $names);
|
||||
|
||||
$constraint = new LogicalOr();
|
||||
$constraint = new LogicalOr;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -76,7 +76,7 @@ final class LogicalOrTest extends ConstraintTestCase
|
||||
*/
|
||||
public function testEvaluateReturnsFalseIfAllOfTheComposedConstraintsEvaluateToFalse(array $constraints): void
|
||||
{
|
||||
$constraint = new LogicalOr();
|
||||
$constraint = new LogicalOr;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -90,7 +90,7 @@ final class LogicalOrTest extends ConstraintTestCase
|
||||
*/
|
||||
public function testEvaluateReturnsTrueIfAnyOfTheComposedConstraintsEvaluateToTrue(array $constraints): void
|
||||
{
|
||||
$constraint = new LogicalOr();
|
||||
$constraint = new LogicalOr;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -106,7 +106,7 @@ final class LogicalOrTest extends ConstraintTestCase
|
||||
{
|
||||
$other = 'whatever';
|
||||
|
||||
$constraint = new LogicalOr();
|
||||
$constraint = new LogicalOr;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -138,7 +138,7 @@ EOF;
|
||||
$other = 'whatever';
|
||||
$customDescription = 'Not very happy about the results at this point in time, I have to admit!';
|
||||
|
||||
$constraint = new LogicalOr();
|
||||
$constraint = new LogicalOr;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -171,7 +171,7 @@ EOF;
|
||||
*/
|
||||
public function testEvaluateReturnsNothingIfAnyOfTheComposedConstraintsEvaluateToTrue(array $constraints): void
|
||||
{
|
||||
$constraint = new LogicalOr();
|
||||
$constraint = new LogicalOr;
|
||||
|
||||
$constraint->setConstraints($constraints);
|
||||
|
||||
@@ -182,14 +182,14 @@ EOF;
|
||||
{
|
||||
$values = [
|
||||
'single' => [
|
||||
new \FalsyConstraint(),
|
||||
new \FalsyConstraint(),
|
||||
new \FalsyConstraint(),
|
||||
new \FalsyConstraint,
|
||||
new \FalsyConstraint,
|
||||
new \FalsyConstraint,
|
||||
],
|
||||
'multiple' => [
|
||||
new \FalsyConstraint(),
|
||||
new \FalsyConstraint(),
|
||||
new \FalsyConstraint(),
|
||||
new \FalsyConstraint,
|
||||
new \FalsyConstraint,
|
||||
new \FalsyConstraint,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -204,12 +204,12 @@ EOF;
|
||||
{
|
||||
$values = [
|
||||
'single' => [
|
||||
new \TruthyConstraint(),
|
||||
new \TruthyConstraint,
|
||||
],
|
||||
'multiple' => [
|
||||
new \FalsyConstraint(),
|
||||
new \TruthyConstraint(),
|
||||
new \FalsyConstraint(),
|
||||
new \FalsyConstraint,
|
||||
new \TruthyConstraint,
|
||||
new \FalsyConstraint,
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ class MockObjectTest extends TestCase
|
||||
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->will($this->throwException(new \Exception()));
|
||||
->will($this->throwException(new \Exception));
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
|
||||
@@ -185,7 +185,7 @@ class MockObjectTest extends TestCase
|
||||
|
||||
$mock->expects($this->any())
|
||||
->method('doSomething')
|
||||
->willThrowException(new \Exception());
|
||||
->willThrowException(new \Exception);
|
||||
|
||||
$this->expectException(\Exception::class);
|
||||
|
||||
@@ -660,7 +660,7 @@ class MockObjectTest extends TestCase
|
||||
$this->fail('Expected exception');
|
||||
} catch (ExpectationFailedException $e) {
|
||||
$this->assertSame(
|
||||
'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . "\n" .
|
||||
"Expectation failed for method name is equal to 'right' when invoked 1 time(s).\n" .
|
||||
'Method was expected to be called 1 times, actually called 0 times.' . "\n",
|
||||
$e->getMessage()
|
||||
);
|
||||
@@ -685,7 +685,7 @@ class MockObjectTest extends TestCase
|
||||
$this->fail('Expected exception');
|
||||
} catch (ExpectationFailedException $e) {
|
||||
$this->assertSame(
|
||||
'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . "\n" .
|
||||
"Expectation failed for method name is equal to 'right' when invoked 1 time(s).\n" .
|
||||
'Method was expected to be called 1 times, actually called 0 times.' . "\n",
|
||||
$e->getMessage()
|
||||
);
|
||||
@@ -708,7 +708,7 @@ class MockObjectTest extends TestCase
|
||||
$mock->right(['second']);
|
||||
} catch (ExpectationFailedException $e) {
|
||||
$this->assertSame(
|
||||
'Expectation failed for method name is equal to "right" when invoked 1 time(s)' . "\n" .
|
||||
"Expectation failed for method name is equal to 'right' when invoked 1 time(s)\n" .
|
||||
'Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.' . "\n" .
|
||||
'Failed asserting that two arrays are equal.',
|
||||
$e->getMessage()
|
||||
@@ -722,7 +722,7 @@ class MockObjectTest extends TestCase
|
||||
// $this->fail('Expected exception');
|
||||
} catch (ExpectationFailedException $e) {
|
||||
$this->assertSame(
|
||||
'Expectation failed for method name is equal to "right" when invoked 1 time(s).' . "\n" .
|
||||
"Expectation failed for method name is equal to 'right' when invoked 1 time(s).\n" .
|
||||
'Parameter 0 for invocation SomeClass::right(Array (...)) does not match expected value.' . "\n" .
|
||||
'Failed asserting that two arrays are equal.' . "\n" .
|
||||
'--- Expected' . "\n" .
|
||||
@@ -801,7 +801,7 @@ class MockObjectTest extends TestCase
|
||||
$this->fail('Expected exception');
|
||||
} catch (ExpectationFailedException $e) {
|
||||
$this->assertSame(
|
||||
'Expectation failed for method name is equal to "right" when invoked 1 time(s)' . "\n" .
|
||||
"Expectation failed for method name is equal to 'right' when invoked 1 time(s)\n" .
|
||||
'Parameter count for invocation SomeClass::right() is too low.' . "\n" .
|
||||
'To allow 0 or more parameters with any value, omit ->with() or use ->withAnyParameters() instead.',
|
||||
$e->getMessage()
|
||||
@@ -947,7 +947,7 @@ class MockObjectTest extends TestCase
|
||||
*/
|
||||
public function testCreateMockOfWsdlFileWithSpecialChars(): void
|
||||
{
|
||||
$mock = $this->getMockFromWsdl(__DIR__ . '/_fixture/Go ogle-Sea.rch.wsdl');
|
||||
$mock = $this->getMockFromWsdl(TEST_FILES_PATH . 'Go ogle-Sea.rch.wsdl');
|
||||
|
||||
$this->assertStringStartsWith('Mock_GoogleSearch_', \get_class($mock));
|
||||
}
|
||||
@@ -1000,7 +1000,7 @@ class MockObjectTest extends TestCase
|
||||
/** @var PHPUnit\Framework\MockObject\MockObject|StringableClass $mock */
|
||||
$mock = $this->getMockBuilder(StringableClass::class)->getMock();
|
||||
|
||||
$this->assertInternalType('string', (string) $mock);
|
||||
$this->assertIsString((string) $mock);
|
||||
}
|
||||
|
||||
public function testStringableClassCanBeMocked(): void
|
||||
|
||||
@@ -723,7 +723,7 @@ class TestCaseTest extends TestCase
|
||||
$test = new \TestAutoreferenced('testJsonEncodeException', $this->getAutoreferencedArray());
|
||||
$test->runBare();
|
||||
|
||||
$this->assertInternalType('array', $test->myTestData);
|
||||
$this->assertIsArray($test->myTestData);
|
||||
$this->assertArrayHasKey('data', $test->myTestData);
|
||||
$this->assertEquals($test->myTestData['data'][0], $test->myTestData['data']);
|
||||
}
|
||||
@@ -739,13 +739,13 @@ class TestCaseTest extends TestCase
|
||||
$test = new \TestAutoreferenced('testJsonEncodeException', [$data]);
|
||||
$test->runBare();
|
||||
|
||||
$this->assertInternalType('array', $test->myTestData);
|
||||
$this->assertIsArray($test->myTestData);
|
||||
$this->assertSame($data, $test->myTestData);
|
||||
}
|
||||
|
||||
public function testGettingNullTestResultObject(): void
|
||||
{
|
||||
$test = new \Success();
|
||||
$test = new \Success;
|
||||
$this->assertNull($test->getTestResultObject());
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
*/
|
||||
namespace PHPUnit\Framework;
|
||||
|
||||
use PHPUnit\Framework\Error\Error;
|
||||
use SebastianBergmann\Comparator\ComparisonFailure;
|
||||
|
||||
class TestFailureTest extends TestCase
|
||||
{
|
||||
public function testToString(): void
|
||||
@@ -29,6 +32,15 @@ class TestFailureTest extends TestCase
|
||||
$this->assertEquals(__METHOD__ . ': message', $failure->toString());
|
||||
}
|
||||
|
||||
public function testToStringForNonSelfDescribing(): void
|
||||
{
|
||||
$test = new \NotSelfDescribingTest();
|
||||
$exception = new Exception('message');
|
||||
$failure = new TestFailure($test, $exception);
|
||||
|
||||
$this->assertEquals('NotSelfDescribingTest: message', $failure->toString());
|
||||
}
|
||||
|
||||
public function testgetExceptionAsString(): void
|
||||
{
|
||||
$test = new self(__FUNCTION__);
|
||||
@@ -37,4 +49,93 @@ class TestFailureTest extends TestCase
|
||||
|
||||
$this->assertEquals("Error: message\n", $failure->getExceptionAsString());
|
||||
}
|
||||
|
||||
public function testExceptionToString(): void
|
||||
{
|
||||
$exception = new AssertionFailedError('message');
|
||||
|
||||
$this->assertEquals("message\n", TestFailure::exceptionToString($exception));
|
||||
}
|
||||
|
||||
public function testExceptionToStringForExpectationFailedException(): void
|
||||
{
|
||||
$exception = new ExpectationFailedException('message');
|
||||
|
||||
$this->assertEquals("message\n", TestFailure::exceptionToString($exception));
|
||||
}
|
||||
|
||||
public function testExceptionToStringForExpectationFailedExceptionWithComparisonFailure(): void
|
||||
{
|
||||
$exception = new ExpectationFailedException('message', new ComparisonFailure('expected', 'actual', 'expected', 'actual'));
|
||||
|
||||
$this->assertEquals("message\n--- Expected\n+++ Actual\n@@ @@\n-expected\n+actual\n", TestFailure::exceptionToString($exception));
|
||||
}
|
||||
|
||||
public function testExceptionToStringForFrameworkError(): void
|
||||
{
|
||||
$exception = new Error('message', 0, 'file', 1);
|
||||
|
||||
$this->assertEquals("message\n", TestFailure::exceptionToString($exception));
|
||||
}
|
||||
|
||||
public function testExceptionToStringForExceptionWrapper(): void
|
||||
{
|
||||
$exception = new ExceptionWrapper(new \Error('message'));
|
||||
|
||||
$this->assertEquals("Error: message\n", TestFailure::exceptionToString($exception));
|
||||
}
|
||||
|
||||
public function testGetTestName(): void
|
||||
{
|
||||
$test = new self(__FUNCTION__);
|
||||
$exception = new Exception('message');
|
||||
$failure = new TestFailure($test, $exception);
|
||||
|
||||
$this->assertEquals($this->toString(), $failure->getTestName());
|
||||
}
|
||||
|
||||
public function testFailedTest(): void
|
||||
{
|
||||
$test = new self(__FUNCTION__);
|
||||
$exception = new Exception('message');
|
||||
$failure = new TestFailure($test, $exception);
|
||||
|
||||
$this->assertEquals($test, $failure->failedTest());
|
||||
}
|
||||
|
||||
public function testThrownException(): void
|
||||
{
|
||||
$test = new self(__FUNCTION__);
|
||||
$exception = new Exception('message');
|
||||
$failure = new TestFailure($test, $exception);
|
||||
|
||||
$this->assertEquals($exception, $failure->thrownException());
|
||||
}
|
||||
|
||||
public function testExceptionMessage(): void
|
||||
{
|
||||
$test = new self(__FUNCTION__);
|
||||
$exception = new Exception('message');
|
||||
$failure = new TestFailure($test, $exception);
|
||||
|
||||
$this->assertEquals('message', $failure->exceptionMessage());
|
||||
}
|
||||
|
||||
public function testIsFailure(): void
|
||||
{
|
||||
$test = new self(__FUNCTION__);
|
||||
$exception = new ExpectationFailedException('message');
|
||||
$failure = new TestFailure($test, $exception);
|
||||
|
||||
$this->assertTrue($failure->isFailure());
|
||||
}
|
||||
|
||||
public function testIsFailureFalse(): void
|
||||
{
|
||||
$test = new self(__FUNCTION__);
|
||||
$exception = new Warning('message');
|
||||
$failure = new TestFailure($test, $exception);
|
||||
|
||||
$this->assertFalse($failure->isFailure());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,85 +9,26 @@
|
||||
*/
|
||||
namespace PHPUnit\Framework;
|
||||
|
||||
class TestListenerTest extends TestCase implements TestListener
|
||||
use MyTestListener;
|
||||
|
||||
final class TestListenerTest extends TestCase
|
||||
{
|
||||
protected $endCount;
|
||||
/**
|
||||
* @var TestResult
|
||||
*/
|
||||
private $result;
|
||||
|
||||
protected $errorCount;
|
||||
|
||||
protected $failureCount;
|
||||
|
||||
protected $warningCount;
|
||||
|
||||
protected $notImplementedCount;
|
||||
|
||||
protected $riskyCount;
|
||||
|
||||
protected $skippedCount;
|
||||
|
||||
protected $result;
|
||||
|
||||
protected $startCount;
|
||||
/**
|
||||
* @var MyTestListener
|
||||
*/
|
||||
private $listener;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->result = new TestResult;
|
||||
$this->result->addListener($this);
|
||||
$this->result = new TestResult;
|
||||
$this->listener = new MyTestListener;
|
||||
|
||||
$this->endCount = 0;
|
||||
$this->failureCount = 0;
|
||||
$this->notImplementedCount = 0;
|
||||
$this->riskyCount = 0;
|
||||
$this->skippedCount = 0;
|
||||
$this->startCount = 0;
|
||||
}
|
||||
|
||||
public function addError(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->errorCount++;
|
||||
}
|
||||
|
||||
public function addWarning(Test $test, Warning $e, float $time): void
|
||||
{
|
||||
$this->warningCount++;
|
||||
}
|
||||
|
||||
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
|
||||
{
|
||||
$this->failureCount++;
|
||||
}
|
||||
|
||||
public function addIncompleteTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->notImplementedCount++;
|
||||
}
|
||||
|
||||
public function addRiskyTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->riskyCount++;
|
||||
}
|
||||
|
||||
public function addSkippedTest(Test $test, \Throwable $t, float $time): void
|
||||
{
|
||||
$this->skippedCount++;
|
||||
}
|
||||
|
||||
public function startTestSuite(TestSuite $suite): void
|
||||
{
|
||||
}
|
||||
|
||||
public function endTestSuite(TestSuite $suite): void
|
||||
{
|
||||
}
|
||||
|
||||
public function startTest(Test $test): void
|
||||
{
|
||||
$this->startCount++;
|
||||
}
|
||||
|
||||
public function endTest(Test $test, float $time): void
|
||||
{
|
||||
$this->endCount++;
|
||||
$this->result->addListener($this->listener);
|
||||
}
|
||||
|
||||
public function testError(): void
|
||||
@@ -95,8 +36,8 @@ class TestListenerTest extends TestCase implements TestListener
|
||||
$test = new \TestError;
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertEquals(1, $this->errorCount);
|
||||
$this->assertEquals(1, $this->endCount);
|
||||
$this->assertEquals(1, $this->listener->errorCount());
|
||||
$this->assertEquals(1, $this->listener->endCount());
|
||||
}
|
||||
|
||||
public function testFailure(): void
|
||||
@@ -104,8 +45,8 @@ class TestListenerTest extends TestCase implements TestListener
|
||||
$test = new \Failure;
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertEquals(1, $this->failureCount);
|
||||
$this->assertEquals(1, $this->endCount);
|
||||
$this->assertEquals(1, $this->listener->failureCount());
|
||||
$this->assertEquals(1, $this->listener->endCount());
|
||||
}
|
||||
|
||||
public function testStartStop(): void
|
||||
@@ -113,7 +54,7 @@ class TestListenerTest extends TestCase implements TestListener
|
||||
$test = new \Success;
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertEquals(1, $this->startCount);
|
||||
$this->assertEquals(1, $this->endCount);
|
||||
$this->assertEquals(1, $this->listener->startCount());
|
||||
$this->assertEquals(1, $this->listener->endCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class TestResultTest extends TestCase
|
||||
{
|
||||
public function testRemoveListenerRemovesOnlyExpectedListener(): void
|
||||
{
|
||||
$result = new TestResult();
|
||||
$result = new TestResult;
|
||||
$firstListener = $this->getMockBuilder(TestListener::class)->getMock();
|
||||
$secondListener = $this->getMockBuilder(TestListener::class)->getMock();
|
||||
$thirdListener = $this->getMockBuilder(TestListener::class)->getMock();
|
||||
@@ -37,8 +37,8 @@ class TestResultTest extends TestCase
|
||||
public function testAddErrorOfTypeIncompleteTest(): void
|
||||
{
|
||||
$time = 17;
|
||||
$throwable = new IncompleteTestError();
|
||||
$result = new TestResult();
|
||||
$throwable = new IncompleteTestError;
|
||||
$result = new TestResult;
|
||||
$test = $this->getMockBuilder(Test::class)->getMock();
|
||||
$listener = $this->getMockBuilder(TestListener::class)->getMock();
|
||||
|
||||
@@ -79,7 +79,7 @@ class TestResultTest extends TestCase
|
||||
{
|
||||
require_once TEST_FILES_PATH . $testCase . '.php';
|
||||
|
||||
$test = new $testCase();
|
||||
$test = new $testCase;
|
||||
$canSkipCoverage = TestResult::isAnyCoverageRequired($test);
|
||||
$this->assertEquals($expectedCanSkip, $canSkipCoverage);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,16 @@ EOF;
|
||||
$this->testCase = null;
|
||||
}
|
||||
|
||||
public function testAlwaysReportsNumberOfAssertionsIsOne(): void
|
||||
{
|
||||
$this->assertSame(1, $this->testCase->getNumAssertions());
|
||||
}
|
||||
|
||||
public function testAlwaysReportsItDoesNotUseADataprovider(): void
|
||||
{
|
||||
$this->assertSame(false, $this->testCase->usesDataProvider());
|
||||
}
|
||||
|
||||
public function testShouldRunFileSectionAsTest(): void
|
||||
{
|
||||
$this->setPhpContent($this->ensureCorrectEndOfLine(self::EXPECT_CONTENT));
|
||||
|
||||
@@ -61,14 +61,14 @@ class ResultCacheExtensionTest extends TestCase
|
||||
{
|
||||
return [
|
||||
'ClassName::testMethod' => [
|
||||
TestCaseTest::class . '::testSomething',
|
||||
'testSomething', ],
|
||||
'testSomething',
|
||||
TestCaseTest::class . '::testSomething', ],
|
||||
'ClassName::testMethod and data set number and vardump' => [
|
||||
TestCaseTest::class . '::testMethod with data set #123 (\'a\', "A", 0, false)',
|
||||
'testMethod with data set #123', ],
|
||||
'testMethod with data set #123 (\'a\', "A", 0, false)',
|
||||
TestCaseTest::class . '::testMethod with data set #123', ],
|
||||
'ClassName::testMethod and data set name and vardump' => [
|
||||
TestCaseTest::class . '::testMethod with data set "data name" (\'a\', "A\", 0, false)',
|
||||
'testMethod with data set "data name"', ],
|
||||
'testMethod with data set "data name" (\'a\', "A\", 0, false)',
|
||||
TestCaseTest::class . '::testMethod with data set "data name"', ],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ class ResultCacheExtensionTest extends TestCase
|
||||
$test = new \TestError('test_name');
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertSame(BaseTestRunner::STATUS_ERROR, $this->cache->getState('test_name'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_ERROR, $this->cache->getState(\TestError::class . '::test_name'));
|
||||
}
|
||||
|
||||
public function testFailure(): void
|
||||
@@ -85,7 +85,7 @@ class ResultCacheExtensionTest extends TestCase
|
||||
$test = new \Failure('test_name');
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertSame(BaseTestRunner::STATUS_FAILURE, $this->cache->getState('test_name'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_FAILURE, $this->cache->getState(\Failure::class . '::test_name'));
|
||||
}
|
||||
|
||||
public function testSkipped(): void
|
||||
@@ -93,7 +93,7 @@ class ResultCacheExtensionTest extends TestCase
|
||||
$test = new \TestSkipped('test_name');
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertSame(BaseTestRunner::STATUS_SKIPPED, $this->cache->getState('test_name'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_SKIPPED, $this->cache->getState(\TestSkipped::class . '::test_name'));
|
||||
}
|
||||
|
||||
public function testIncomplete(): void
|
||||
@@ -101,7 +101,7 @@ class ResultCacheExtensionTest extends TestCase
|
||||
$test = new \TestIncomplete('test_name');
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertSame(BaseTestRunner::STATUS_INCOMPLETE, $this->cache->getState('test_name'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_INCOMPLETE, $this->cache->getState(\TestIncomplete::class . '::test_name'));
|
||||
}
|
||||
|
||||
public function testPassedTestsOnlyCacheTime(): void
|
||||
@@ -109,7 +109,7 @@ class ResultCacheExtensionTest extends TestCase
|
||||
$test = new \Success('test_name');
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertSame(BaseTestRunner::STATUS_UNKNOWN, $this->cache->getState('test_name'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_UNKNOWN, $this->cache->getState(\Success::class . '::test_name'));
|
||||
}
|
||||
|
||||
public function testWarning(): void
|
||||
@@ -117,7 +117,7 @@ class ResultCacheExtensionTest extends TestCase
|
||||
$test = new \TestWarning('test_name');
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertSame(BaseTestRunner::STATUS_WARNING, $this->cache->getState('test_name'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_WARNING, $this->cache->getState(\TestWarning::class . '::test_name'));
|
||||
}
|
||||
|
||||
public function testRisky(): void
|
||||
@@ -125,7 +125,7 @@ class ResultCacheExtensionTest extends TestCase
|
||||
$test = new \TestRisky('test_name');
|
||||
$test->run($this->result);
|
||||
|
||||
$this->assertSame(BaseTestRunner::STATUS_RISKY, $this->cache->getState('test_name'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_RISKY, $this->cache->getState(\TestRisky::class . '::test_name'));
|
||||
}
|
||||
|
||||
public function testEmptySuite(): void
|
||||
|
||||
@@ -24,11 +24,19 @@ class TestSuiteSorterTest extends TestCase
|
||||
|
||||
private const RESOLVE_DEPENDENCIES = true;
|
||||
|
||||
private const MULTIDEPENDENCYTEST_EXECUTION_ORDER = [
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
];
|
||||
|
||||
public function testThrowsExceptionWhenUsingInvalidOrderOption(): void
|
||||
{
|
||||
$suite = new TestSuite;
|
||||
$suite->addTestSuite(\MultiDependencyTest::class);
|
||||
$sorter = new TestSuiteSorter();
|
||||
$sorter = new TestSuiteSorter;
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('$order must be one of TestSuiteSorter::ORDER_DEFAULT, TestSuiteSorter::ORDER_REVERSED, or TestSuiteSorter::ORDER_RANDOMIZED, or TestSuiteSorter::ORDER_DURATION');
|
||||
@@ -39,7 +47,7 @@ class TestSuiteSorterTest extends TestCase
|
||||
{
|
||||
$suite = new TestSuite;
|
||||
$suite->addTestSuite(\MultiDependencyTest::class);
|
||||
$sorter = new TestSuiteSorter();
|
||||
$sorter = new TestSuiteSorter;
|
||||
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('$orderDefects must be one of TestSuiteSorter::ORDER_DEFAULT, TestSuiteSorter::ORDER_DEFECTS_FIRST');
|
||||
@@ -54,49 +62,66 @@ class TestSuiteSorterTest extends TestCase
|
||||
$sorter = new TestSuiteSorter;
|
||||
$suite = new TestSuite;
|
||||
|
||||
$this->assertSame([], $suite->tests());
|
||||
|
||||
$sorter->reorderTestsInSuite($suite, $order, $resolveDependencies, $orderDefects);
|
||||
|
||||
$this->assertSame([], $suite->tests());
|
||||
$this->assertEmpty($suite->tests());
|
||||
$this->assertEmpty($sorter->getOriginalExecutionOrder());
|
||||
$this->assertEmpty($sorter->getExecutionOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider commonSorterOptionsProvider
|
||||
*/
|
||||
public function testBasicExecutionOrderOptions(int $order, bool $resolveDependencies, array $expected): void
|
||||
public function testBasicExecutionOrderOptions(int $order, bool $resolveDependencies, array $expectedOrder): void
|
||||
{
|
||||
$suite = new TestSuite;
|
||||
$suite->addTestSuite(\MultiDependencyTest::class);
|
||||
$sorter = new TestSuiteSorter();
|
||||
$sorter = new TestSuiteSorter;
|
||||
|
||||
$sorter->reorderTestsInSuite($suite, $order, $resolveDependencies, TestSuiteSorter::ORDER_DEFAULT);
|
||||
|
||||
$this->assertSame($expected, $this->getTestExecutionOrder($suite));
|
||||
$this->assertSame(self::MULTIDEPENDENCYTEST_EXECUTION_ORDER, $sorter->getOriginalExecutionOrder());
|
||||
$this->assertSame($expectedOrder, $sorter->getExecutionOrder());
|
||||
}
|
||||
|
||||
public function testCanSetRandomizationWithASeed(): void
|
||||
{
|
||||
$suite = new TestSuite;
|
||||
$suite->addTestSuite(\MultiDependencyTest::class);
|
||||
$sorter = new TestSuiteSorter();
|
||||
$sorter = new TestSuiteSorter;
|
||||
|
||||
\mt_srand(54321);
|
||||
$sorter->reorderTestsInSuite($suite, TestSuiteSorter::ORDER_RANDOMIZED, false, TestSuiteSorter::ORDER_DEFAULT);
|
||||
|
||||
$this->assertSame(['testTwo', 'testFour', 'testFive', 'testThree', 'testOne'], $this->getTestExecutionOrder($suite));
|
||||
$expectedOrder = [
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
];
|
||||
|
||||
$this->assertSame($expectedOrder, $sorter->getExecutionOrder());
|
||||
}
|
||||
|
||||
public function testCanSetRandomizationWithASeedAndResolveDependencies(): void
|
||||
{
|
||||
$suite = new TestSuite;
|
||||
$suite->addTestSuite(\MultiDependencyTest::class);
|
||||
$sorter = new TestSuiteSorter();
|
||||
$sorter = new TestSuiteSorter;
|
||||
|
||||
\mt_srand(54321);
|
||||
$sorter->reorderTestsInSuite($suite, TestSuiteSorter::ORDER_RANDOMIZED, true, TestSuiteSorter::ORDER_DEFAULT);
|
||||
|
||||
$this->assertSame(['testTwo', 'testFive', 'testOne', 'testThree', 'testFour'], $this->getTestExecutionOrder($suite));
|
||||
$expectedOrder = [
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
];
|
||||
|
||||
$this->assertSame($expectedOrder, $sorter->getExecutionOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +133,7 @@ class TestSuiteSorterTest extends TestCase
|
||||
|
||||
$suite->addTestSuite(\MultiDependencyTest::class);
|
||||
|
||||
$sorter = new TestSuiteSorter();
|
||||
$sorter = new TestSuiteSorter;
|
||||
|
||||
$sorter->reorderTestsInSuite(
|
||||
$suite,
|
||||
@@ -117,7 +142,7 @@ class TestSuiteSorterTest extends TestCase
|
||||
TestSuiteSorter::ORDER_DEFAULT
|
||||
);
|
||||
|
||||
$this->assertSame($expected, $this->getTestExecutionOrder($suite));
|
||||
$this->assertSame($expected, $sorter->getExecutionOrder());
|
||||
}
|
||||
|
||||
public function orderDurationWithoutCacheProvider(): array
|
||||
@@ -126,21 +151,21 @@ class TestSuiteSorterTest extends TestCase
|
||||
'dependency-ignore' => [
|
||||
self::IGNORE_DEPENDENCIES,
|
||||
[
|
||||
'testOne',
|
||||
'testTwo',
|
||||
'testThree',
|
||||
'testFour',
|
||||
'testFive',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
],
|
||||
],
|
||||
'dependency-resolve' => [
|
||||
self::RESOLVE_DEPENDENCIES,
|
||||
[
|
||||
'testOne',
|
||||
'testTwo',
|
||||
'testThree',
|
||||
'testFour',
|
||||
'testFive',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -155,10 +180,10 @@ class TestSuiteSorterTest extends TestCase
|
||||
|
||||
$suite->addTestSuite(\MultiDependencyTest::class);
|
||||
|
||||
$cache = new TestResultCache();
|
||||
$cache = new TestResultCache;
|
||||
|
||||
foreach ($testTimes as $testName => $time) {
|
||||
$cache->setTime($testName, $time);
|
||||
$cache->setTime(\MultiDependencyTest::class . '::' . $testName, $time);
|
||||
}
|
||||
|
||||
$sorter = new TestSuiteSorter($cache);
|
||||
@@ -170,7 +195,7 @@ class TestSuiteSorterTest extends TestCase
|
||||
TestSuiteSorter::ORDER_DEFAULT
|
||||
);
|
||||
|
||||
$this->assertSame($expected, $this->getTestExecutionOrder($suite));
|
||||
$this->assertSame($expected, $sorter->getExecutionOrder());
|
||||
}
|
||||
|
||||
public function orderDurationWithCacheProvider(): array
|
||||
@@ -186,11 +211,11 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFive' => 1,
|
||||
],
|
||||
[
|
||||
'testOne',
|
||||
'testTwo',
|
||||
'testThree',
|
||||
'testFour',
|
||||
'testFive',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
],
|
||||
],
|
||||
'duration-same-dependency-resolve' => [
|
||||
@@ -203,11 +228,11 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFive' => 1,
|
||||
],
|
||||
[
|
||||
'testOne',
|
||||
'testTwo',
|
||||
'testThree',
|
||||
'testFour',
|
||||
'testFive',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
],
|
||||
],
|
||||
'duration-different-dependency-ignore' => [
|
||||
@@ -220,11 +245,11 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFive' => 2,
|
||||
],
|
||||
[
|
||||
'testFour',
|
||||
'testFive',
|
||||
'testTwo',
|
||||
'testThree',
|
||||
'testOne',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
],
|
||||
],
|
||||
'duration-different-dependency-resolve' => [
|
||||
@@ -237,11 +262,11 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFive' => 2,
|
||||
],
|
||||
[
|
||||
'testFive',
|
||||
'testTwo',
|
||||
'testOne',
|
||||
'testThree',
|
||||
'testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -255,17 +280,17 @@ class TestSuiteSorterTest extends TestCase
|
||||
$suite = new TestSuite;
|
||||
$suite->addTestSuite(\MultiDependencyTest::class);
|
||||
|
||||
$cache = new TestResultCache();
|
||||
$cache = new TestResultCache;
|
||||
|
||||
foreach ($runState as $testName => $data) {
|
||||
$cache->setState($testName, $data['state']);
|
||||
$cache->setTime($testName, $data['time']);
|
||||
$cache->setState(\MultiDependencyTest::class . '::' . $testName, $data['state']);
|
||||
$cache->setTime(\MultiDependencyTest::class . '::' . $testName, $data['time']);
|
||||
}
|
||||
|
||||
$sorter = new TestSuiteSorter($cache);
|
||||
$sorter->reorderTestsInSuite($suite, $order, $resolveDependencies, TestSuiteSorter::ORDER_DEFECTS_FIRST);
|
||||
|
||||
$this->assertSame($expected, $this->getTestExecutionOrder($suite));
|
||||
$this->assertSame($expected, $sorter->getExecutionOrder());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,28 +307,52 @@ class TestSuiteSorterTest extends TestCase
|
||||
'default' => [
|
||||
TestSuiteSorter::ORDER_DEFAULT,
|
||||
self::IGNORE_DEPENDENCIES,
|
||||
['testOne', 'testTwo', 'testThree', 'testFour', 'testFive'],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
],
|
||||
],
|
||||
|
||||
// Activating dependency resolution should have no effect under normal circumstances
|
||||
'resolve default' => [
|
||||
TestSuiteSorter::ORDER_DEFAULT,
|
||||
self::RESOLVE_DEPENDENCIES,
|
||||
['testOne', 'testTwo', 'testThree', 'testFour', 'testFive'],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
],
|
||||
],
|
||||
|
||||
// Reversing without checks should give a simple reverse order
|
||||
'reverse' => [
|
||||
TestSuiteSorter::ORDER_REVERSED,
|
||||
self::IGNORE_DEPENDENCIES,
|
||||
['testFive', 'testFour', 'testThree', 'testTwo', 'testOne'],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
],
|
||||
],
|
||||
|
||||
// Reversing with resolution still allows testFive to move to front, testTwo before testOne
|
||||
'resolve reverse' => [
|
||||
TestSuiteSorter::ORDER_REVERSED,
|
||||
self::RESOLVE_DEPENDENCIES,
|
||||
['testFive', 'testTwo', 'testOne', 'testThree', 'testFour'],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -330,7 +379,14 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFour' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
'testFive' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
],
|
||||
['testOne', 'testTwo', 'testThree', 'testFour', 'testFive'], ],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
],
|
||||
],
|
||||
|
||||
// Running with an empty cache should not spook the TestSuiteSorter
|
||||
'default, empty result cache' => [
|
||||
@@ -339,7 +395,14 @@ class TestSuiteSorterTest extends TestCase
|
||||
[
|
||||
// empty result cache
|
||||
],
|
||||
['testOne', 'testTwo', 'testThree', 'testFour', 'testFive'], ],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
],
|
||||
],
|
||||
|
||||
// testFive is independent and can be moved to the front
|
||||
'default, testFive skipped' => [
|
||||
@@ -352,7 +415,14 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFour' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
'testFive' => ['state' => BaseTestRunner::STATUS_SKIPPED, 'time' => 1],
|
||||
],
|
||||
['testFive', 'testOne', 'testTwo', 'testThree', 'testFour'], ],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
],
|
||||
],
|
||||
|
||||
// Defects in testFive and testTwo, but the faster testFive should be run first
|
||||
'default, testTwo testFive skipped' => [
|
||||
@@ -365,7 +435,14 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFour' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
'testFive' => ['state' => BaseTestRunner::STATUS_SKIPPED, 'time' => 0],
|
||||
],
|
||||
['testFive', 'testTwo', 'testOne', 'testThree', 'testFour'], ],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
],
|
||||
],
|
||||
|
||||
// Skipping testThree will move it to the front when ignoring dependencies
|
||||
'default, testThree skipped' => [
|
||||
@@ -378,7 +455,14 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFour' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
'testFive' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
],
|
||||
['testThree', 'testOne', 'testTwo', 'testFour', 'testFive'], ],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
],
|
||||
],
|
||||
|
||||
// Skipping testThree will move it to the front but behind its dependencies
|
||||
'default resolve, testThree skipped' => [
|
||||
@@ -391,7 +475,14 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFour' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
'testFive' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
],
|
||||
['testOne', 'testTwo', 'testThree', 'testFour', 'testFive'], ],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
],
|
||||
],
|
||||
|
||||
// Skipping testThree will move it to the front and keep the others reversed
|
||||
'reverse, testThree skipped' => [
|
||||
@@ -404,7 +495,14 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFour' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
'testFive' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
],
|
||||
['testThree', 'testFive', 'testFour', 'testTwo', 'testOne'], ],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
],
|
||||
],
|
||||
|
||||
// Demonstrate a limit of the dependency resolver: after sorting defects to the front,
|
||||
// the resolver will mark testFive done before testThree because of dependencies
|
||||
@@ -418,7 +516,14 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFour' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
'testFive' => ['state' => BaseTestRunner::STATUS_SKIPPED, 'time' => 1],
|
||||
],
|
||||
['testFive', 'testOne', 'testTwo', 'testThree', 'testFour'], ],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
],
|
||||
],
|
||||
|
||||
// Torture test
|
||||
// - incomplete TestResultCache
|
||||
@@ -433,7 +538,14 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testTwo' => ['state' => BaseTestRunner::STATUS_PASSED, 'time' => 1],
|
||||
'testThree' => ['state' => BaseTestRunner::STATUS_SKIPPED, 'time' => 1],
|
||||
],
|
||||
['testFive', 'testTwo', 'testOne', 'testThree', 'testFour'], ],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
],
|
||||
],
|
||||
|
||||
// Make sure the dependency resolver is not confused by failing tests.
|
||||
// Scenario: Four has a @depends on Three and fails. Result: Three is still run first
|
||||
@@ -448,7 +560,14 @@ class TestSuiteSorterTest extends TestCase
|
||||
'testFour' => ['state' => BaseTestRunner::STATUS_FAILURE, 'time' => 1],
|
||||
'testFive' => ['state' => BaseTestRunner::STATUS_FAILURE, 'time' => 1],
|
||||
],
|
||||
['testFive', 'testOne', 'testTwo', 'testThree', 'testFour'], ],
|
||||
[
|
||||
\MultiDependencyTest::class . '::testFive',
|
||||
\MultiDependencyTest::class . '::testOne',
|
||||
\MultiDependencyTest::class . '::testTwo',
|
||||
\MultiDependencyTest::class . '::testThree',
|
||||
\MultiDependencyTest::class . '::testFour',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -460,7 +579,7 @@ class TestSuiteSorterTest extends TestCase
|
||||
$suite = new TestSuite;
|
||||
$suite->addTestSuite(\EmptyTestCaseTest::class);
|
||||
|
||||
$sorter = new TestSuiteSorter();
|
||||
$sorter = new TestSuiteSorter;
|
||||
|
||||
$sorter->reorderTestsInSuite($suite, TestSuiteSorter::ORDER_DEFAULT, false, TestSuiteSorter::ORDER_DEFAULT);
|
||||
|
||||
@@ -486,11 +605,4 @@ class TestSuiteSorterTest extends TestCase
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function getTestExecutionOrder(TestSuite $suite): array
|
||||
{
|
||||
return \array_map(function ($test) {
|
||||
return $test->getName();
|
||||
}, $suite->tests()[0]->tests());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@ class TestRunnerTest extends TestCase
|
||||
{
|
||||
public function testTestIsRunnable(): void
|
||||
{
|
||||
$runner = new TestRunner();
|
||||
$runner = new TestRunner;
|
||||
$runner->setPrinter($this->getResultPrinterMock());
|
||||
$runner->doRun(new \Success(), ['filter' => 'foo'], false);
|
||||
$runner->doRun(new \Success, ['filter' => 'foo'], false);
|
||||
}
|
||||
|
||||
public function testSuiteIsRunnable(): void
|
||||
{
|
||||
$runner = new TestRunner();
|
||||
$runner = new TestRunner;
|
||||
$runner->setPrinter($this->getResultPrinterMock());
|
||||
$runner->doRun($this->getSuiteMock(), ['filter' => 'foo'], false);
|
||||
}
|
||||
|
||||
@@ -428,11 +428,19 @@ class ConfigurationTest extends TestCase
|
||||
*/
|
||||
public function testHandlePHPConfigurationDoesNotOverriteVariablesFromPutEnv(): void
|
||||
{
|
||||
$backupFoo = \getenv('foo');
|
||||
|
||||
\putenv('foo=putenv');
|
||||
$this->configuration->handlePHPConfiguration();
|
||||
|
||||
$this->assertEquals('putenv', $_ENV['foo']);
|
||||
$this->assertEquals('putenv', \getenv('foo'));
|
||||
|
||||
if ($backupFoo === false) {
|
||||
\putenv('foo'); // delete variable from environment
|
||||
} else {
|
||||
\putenv("foo=$backupFoo");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -73,7 +73,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testPrintsCrossForTestWithError(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addError($this, new Exception(), 0);
|
||||
$this->printer->addError($this, new Exception, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertContains('✘', $this->printer->getBuffer());
|
||||
@@ -82,7 +82,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testPrintsAdditionalInformationForTestWithError(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addError($this, new Exception(), 0);
|
||||
$this->printer->addError($this, new Exception, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertContains('│', $this->printer->getBuffer());
|
||||
@@ -91,7 +91,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testPrintsCrossForTestWithWarning(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addWarning($this, new Warning(), 0);
|
||||
$this->printer->addWarning($this, new Warning, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertContains('✘', $this->printer->getBuffer());
|
||||
@@ -100,7 +100,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testPrintsAdditionalInformationForTestWithWarning(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addWarning($this, new Warning(), 0);
|
||||
$this->printer->addWarning($this, new Warning, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertContains('│', $this->printer->getBuffer());
|
||||
@@ -109,7 +109,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testPrintsCrossForTestWithFailure(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addFailure($this, new AssertionFailedError(), 0);
|
||||
$this->printer->addFailure($this, new AssertionFailedError, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertContains('✘', $this->printer->getBuffer());
|
||||
@@ -118,7 +118,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testPrintsAdditionalInformationForTestWithFailure(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addFailure($this, new AssertionFailedError(), 0);
|
||||
$this->printer->addFailure($this, new AssertionFailedError, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertContains('│', $this->printer->getBuffer());
|
||||
@@ -127,7 +127,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testPrintsEmptySetSymbolForTestWithFailure(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addIncompleteTest($this, new Exception(), 0);
|
||||
$this->printer->addIncompleteTest($this, new Exception, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertContains('∅', $this->printer->getBuffer());
|
||||
@@ -136,7 +136,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testDoesNotPrintAdditionalInformationForIncompleteTestByDefault(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addIncompleteTest($this, new Exception(), 0);
|
||||
$this->printer->addIncompleteTest($this, new Exception, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertNotContains('│', $this->printer->getBuffer());
|
||||
@@ -155,7 +155,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testPrintsRadioactiveSymbolForRiskyTest(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addRiskyTest($this, new Exception(), 0);
|
||||
$this->printer->addRiskyTest($this, new Exception, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertContains('☢', $this->printer->getBuffer());
|
||||
@@ -164,7 +164,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testDoesNotPrintAdditionalInformationForRiskyTestByDefault(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addRiskyTest($this, new Exception(), 0);
|
||||
$this->printer->addRiskyTest($this, new Exception, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertNotContains('│', $this->printer->getBuffer());
|
||||
@@ -173,7 +173,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testPrintsAdditionalInformationForRiskyTestInVerboseMode(): void
|
||||
{
|
||||
$this->verbosePrinter->startTest($this);
|
||||
$this->verbosePrinter->addRiskyTest($this, new Exception(), 0);
|
||||
$this->verbosePrinter->addRiskyTest($this, new Exception, 0);
|
||||
$this->verbosePrinter->endTest($this, 0.001);
|
||||
|
||||
$this->assertContains('│', $this->verbosePrinter->getBuffer());
|
||||
@@ -182,7 +182,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testPrintsArrowForSkippedTest(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addSkippedTest($this, new Exception(), 0);
|
||||
$this->printer->addSkippedTest($this, new Exception, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertContains('→', $this->printer->getBuffer());
|
||||
@@ -191,7 +191,7 @@ final class CliTestDoxPrinterTest extends TestCase
|
||||
public function testDoesNotPrintAdditionalInformationForSkippedTestByDefault(): void
|
||||
{
|
||||
$this->printer->startTest($this);
|
||||
$this->printer->addSkippedTest($this, new Exception(), 0);
|
||||
$this->printer->addSkippedTest($this, new Exception, 0);
|
||||
$this->printer->endTest($this, 0.001);
|
||||
|
||||
$this->assertNotContains('│', $this->printer->getBuffer());
|
||||
|
||||
@@ -57,4 +57,116 @@ class NamePrettifierTest extends TestCase
|
||||
$this->assertEquals('Sets redirect header on 301', $this->namePrettifier->prettifyTestMethod('testSetsRedirectHeaderOn301'));
|
||||
$this->assertEquals('Sets redirect header on 302', $this->namePrettifier->prettifyTestMethod('testSetsRedirectHeaderOn302'));
|
||||
}
|
||||
|
||||
public function testPhpDoxIgnoreDataKeys(): void
|
||||
{
|
||||
$test = new class extends TestCase {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('testAddition', [
|
||||
'augend' => 1,
|
||||
'addend' => 2,
|
||||
'result' => 3,
|
||||
]);
|
||||
}
|
||||
|
||||
public function testAddition(int $augend, int $addend, int $result): void
|
||||
{
|
||||
}
|
||||
|
||||
public function getAnnotations(): array
|
||||
{
|
||||
return [
|
||||
'method' => [
|
||||
'testdox' => ['$augend + $addend = $result'],
|
||||
],
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
$this->assertEquals('1 + 2 = 3', $this->namePrettifier->prettifyTestCase($test));
|
||||
}
|
||||
|
||||
public function testPhpDoxUsesDefaultValue(): void
|
||||
{
|
||||
$test = new class extends TestCase {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('testAddition', []);
|
||||
}
|
||||
|
||||
public function testAddition(int $augend = 1, int $addend = 2, int $result = 3): void
|
||||
{
|
||||
}
|
||||
|
||||
public function getAnnotations(): array
|
||||
{
|
||||
return [
|
||||
'method' => [
|
||||
'testdox' => ['$augend + $addend = $result'],
|
||||
],
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
$this->assertEquals('1 + 2 = 3', $this->namePrettifier->prettifyTestCase($test));
|
||||
}
|
||||
|
||||
public function testPhpDoxArgumentExporting(): void
|
||||
{
|
||||
$test = new class extends TestCase {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('testExport', [
|
||||
'int' => 1234,
|
||||
'strInt' => '1234',
|
||||
'float' => 2.123,
|
||||
'strFloat' => '2.123',
|
||||
'string' => 'foo',
|
||||
'bool' => true,
|
||||
'null' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function testExport($int, $strInt, $float, $strFloat, $string, $bool, $null): void
|
||||
{
|
||||
}
|
||||
|
||||
public function getAnnotations(): array
|
||||
{
|
||||
return [
|
||||
'method' => [
|
||||
'testdox' => ['$int, $strInt, $float, $strFloat, $string, $bool, $null'],
|
||||
],
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
$this->assertEquals('1234, 1234, 2.123, 2.123, foo, true, NULL', $this->namePrettifier->prettifyTestCase($test));
|
||||
}
|
||||
|
||||
public function testPhpDoxReplacesLongerVariablesFirst(): void
|
||||
{
|
||||
$test = new class extends TestCase {
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('testFoo', []);
|
||||
}
|
||||
|
||||
public function testFoo(int $a = 1, int $ab = 2, int $abc = 3): void
|
||||
{
|
||||
}
|
||||
|
||||
public function getAnnotations(): array
|
||||
{
|
||||
return [
|
||||
'method' => [
|
||||
'testdox' => ['$a, "$a", $a$ab, $abc, $abcd, $ab'],
|
||||
],
|
||||
];
|
||||
}
|
||||
};
|
||||
|
||||
$this->assertEquals('1, "1", 12, 3, $abcd, 2', $this->namePrettifier->prettifyTestCase($test));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@ class TestResultCacheTest extends TestCase
|
||||
$cache = new TestResultCache($cacheFile);
|
||||
$cache->load();
|
||||
|
||||
$this->assertSame(BaseTestRunner::STATUS_UNKNOWN, $cache->getState('testOne'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_SKIPPED, $cache->getState('testFive'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_UNKNOWN, $cache->getState(\MultiDependencyTest::class . '::testOne'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_SKIPPED, $cache->getState(\MultiDependencyTest::class . '::testFive'));
|
||||
}
|
||||
|
||||
public function testDoesClearCacheBeforeLoad(): void
|
||||
@@ -32,12 +32,12 @@ class TestResultCacheTest extends TestCase
|
||||
$cache = new TestResultCache($cacheFile);
|
||||
$cache->setState('someTest', BaseTestRunner::STATUS_FAILURE);
|
||||
|
||||
$this->assertSame(BaseTestRunner::STATUS_UNKNOWN, $cache->getState('testFive'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_UNKNOWN, $cache->getState(\MultiDependencyTest::class . '::testFive'));
|
||||
|
||||
$cache->load();
|
||||
|
||||
$this->assertSame(BaseTestRunner::STATUS_UNKNOWN, $cache->getState('someTest'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_SKIPPED, $cache->getState('testFive'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_UNKNOWN, $cache->getState(\MultiDependencyTest::class . '::someTest'));
|
||||
$this->assertSame(BaseTestRunner::STATUS_SKIPPED, $cache->getState(\MultiDependencyTest::class . '::testFive'));
|
||||
}
|
||||
|
||||
public function testShouldNotSerializePassedTestsAsDefectButTimeIsStored(): void
|
||||
|
||||
@@ -95,7 +95,7 @@ class XmlTest extends TestCase
|
||||
public function testXmlToVariableCanHandleMultipleOfTheSameArgumentType(): void
|
||||
{
|
||||
$xml = '<object class="SampleClass"><arguments><string>a</string><string>b</string><string>c</string></arguments></object>';
|
||||
$dom = new \DOMDocument();
|
||||
$dom = new \DOMDocument;
|
||||
$dom->loadXML($xml);
|
||||
|
||||
$expected = ['a' => 'a', 'b' => 'b', 'c' => 'c'];
|
||||
@@ -108,7 +108,7 @@ class XmlTest extends TestCase
|
||||
public function testXmlToVariableCanConstructObjectsWithConstructorArgumentsRecursively(): void
|
||||
{
|
||||
$xml = '<object class="Exception"><arguments><string>one</string><integer>0</integer><object class="Exception"><arguments><string>two</string></arguments></object></arguments></object>';
|
||||
$dom = new \DOMDocument();
|
||||
$dom = new \DOMDocument;
|
||||
$dom->loadXML($xml);
|
||||
|
||||
$actual = Xml::xmlToVariable($dom->documentElement);
|
||||
|
||||
Reference in New Issue
Block a user