Skip to content

Commit

Permalink
Merge branch 'master' into remove-class-name-cli-option
Browse files Browse the repository at this point in the history
  • Loading branch information
realFlowControl committed Oct 28, 2019
2 parents 247d75f + 9d5dee1 commit 4a7d508
Show file tree
Hide file tree
Showing 76 changed files with 662 additions and 347 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -1,6 +1,7 @@
/.docker export-ignore
/build export-ignore
/tools export-ignore
/tools/* binary

*.php diff=php

2 changes: 1 addition & 1 deletion .github/FUNDING.yml
@@ -1,2 +1,2 @@
patreon: s_bergmann
github: sebastianbergmann
custom: https://phpunit.de/donate.html
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -41,4 +41,4 @@ jobs:
uses: actions/checkout@master

- name: Run roave/backward-compatibility-check
run: php7.3 ./tools/roave-backward-compatibility-check --from=dfad4702af08b4d706dbc57a8badfa1dfe0cd046
run: php7.3 ./tools/roave-backward-compatibility-check --from=42afe2b8b42077b26148272bd03da4ab6e46a072
37 changes: 16 additions & 21 deletions .psalm/baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.4.12@86e5e50c1bb492045e70f2ebe1da3cad06e4e9b2">
<files psalm-version="3.5.3@c3e781c4a06cbb17dc32068eb5d6de075f6babdc">
<file src="src/Framework/Assert.php">
<ArgumentTypeCoercion occurrences="2">
<code>$expectedElement-&gt;childNodes-&gt;item($i)</code>
Expand Down Expand Up @@ -83,6 +83,11 @@
<code>"--- Expected\n+++ Actual\n"</code>
</InvalidArgument>
</file>
<file src="src/Framework/DataProviderTestSuite.php">
<ArgumentTypeCoercion occurrences="1">
<code>$className</code>
</ArgumentTypeCoercion>
</file>
<file src="src/Framework/Exception/ExpectationFailedException.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>$comparisonFailure</code>
Expand Down Expand Up @@ -135,16 +140,6 @@
<code>\WSDL_CACHE_NONE</code>
</UndefinedConstant>
</file>
<file src="src/Framework/MockObject/Matcher/ConsecutiveParameters.php">
<TypeDoesNotContainNull occurrences="1">
<code>$invocation === null</code>
</TypeDoesNotContainNull>
</file>
<file src="src/Framework/MockObject/Matcher/Parameters.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>null</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/Framework/MockObject/MockBuilder.php">
<ArgumentTypeCoercion occurrences="2">
<code>$this-&gt;type</code>
Expand All @@ -159,6 +154,16 @@
<code>allowsNull</code>
</PossiblyNullReference>
</file>
<file src="src/Framework/MockObject/Rule/ConsecutiveParameters.php">
<TypeDoesNotContainNull occurrences="1">
<code>$invocation === null</code>
</TypeDoesNotContainNull>
</file>
<file src="src/Framework/MockObject/Rule/Parameters.php">
<PossiblyNullPropertyAssignmentValue occurrences="1">
<code>null</code>
</PossiblyNullPropertyAssignmentValue>
</file>
<file src="src/Framework/TestCase.php">
<ArgumentTypeCoercion occurrences="2">
<code>$class_name</code>
Expand Down Expand Up @@ -279,11 +284,6 @@
<file src="src/Util/Annotation/DocBlock.php">
<InvalidCatch occurrences="1"/>
</file>
<file src="src/Util/Annotation/RegistryTest.php">
<UndefinedClass occurrences="1">
<code>\ThisClassDoesNotExist</code>
</UndefinedClass>
</file>
<file src="src/Util/Blacklist.php">
<UndefinedClass occurrences="1">
<code>Invoker</code>
Expand Down Expand Up @@ -421,11 +421,6 @@
</PossiblyNullArgument>
</file>
<file src="src/Util/Test.php">
<ArgumentTypeCoercion occurrences="3">
<code>$className</code>
<code>$className</code>
<code>$className</code>
</ArgumentTypeCoercion>
<InvalidScalarArgument occurrences="1">
<code>\array_flip($lineNumbers)</code>
</InvalidScalarArgument>
Expand Down
65 changes: 0 additions & 65 deletions ChangeLog-8.3.md

This file was deleted.

19 changes: 18 additions & 1 deletion ChangeLog-8.4.md
Expand Up @@ -2,6 +2,21 @@

All notable changes of the PHPUnit 8.4 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [8.4.2] - 2019-MM-DD

### Fixed

* Fixed [#3889](https://github.com/sebastianbergmann/phpunit/issues/3889): Test(s) not found when source filename does not match test case class name
* Fixed [#3893](https://github.com/sebastianbergmann/phpunit/issues/3893): `TypeError` when called with a filename without extension

## [8.4.1] - 2019-10-07

### Fixed

* Fixed [#3879](https://github.com/sebastianbergmann/phpunit/issues/3879): Tests with data providers in parent class do not work anymore
* Fixed [#3881](https://github.com/sebastianbergmann/phpunit/issues/3881): Regression with multiple test case classes declared in a single sourcecode file
* Fixed [#3884](https://github.com/sebastianbergmann/phpunit/issues/3884): Uncaught `ReflectionException` with TestDox XML report

## [8.4.0] - 2019-10-04

### Added
Expand All @@ -13,5 +28,7 @@ All notable changes of the PHPUnit 8.4 release series are documented in this fil

* The method `expectExceptionMessageRegExp()` is now deprecated. There is no behavioral change in this version of PHPUnit. Using this method will trigger a deprecation warning in PHPUnit 9 and in PHPUnit 10 it will be removed. Please use `expectExceptionMessageMatches()` instead.

[8.4.0]: https://github.com/sebastianbergmann/phpunit/compare/8.3...8.4.0
[8.4.2]: https://github.com/sebastianbergmann/phpunit/compare/8.4.1...8.4
[8.4.1]: https://github.com/sebastianbergmann/phpunit/compare/8.4.0...8.4.1
[8.4.0]: https://github.com/sebastianbergmann/phpunit/compare/8.3.5...8.4.0

8 changes: 8 additions & 0 deletions ChangeLog-8.5.md
@@ -0,0 +1,8 @@
# Changes in PHPUnit 8.5

All notable changes of the PHPUnit 8.5 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## [8.5.0] - 2019-12-06

[8.5.0]: https://github.com/sebastianbergmann/phpunit/compare/8.4...master

2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -9,7 +9,7 @@ PHPUnit is a programmer-oriented testing framework for PHP. It is an instance of

## Installation

We distribute a [PHP Archive (PHAR)](https://php.net/phar) that has all required (as well as some optional) dependencies of PHPUnit 8.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 8.5 bundled in a single file:

```bash
$ wget https://phar.phpunit.de/phpunit-nightly.phar
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -83,7 +83,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "8.4-dev"
"dev-master": "8.5-dev"
}
}
}
6 changes: 3 additions & 3 deletions phive.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpab" version="^1.25" installed="1.25.6" location="./tools/phpab" copy="true"/>
<phar name="php-cs-fixer" version="^2.14" installed="2.15.3" location="./tools/php-cs-fixer" copy="true"/>
<phar name="phpdox" version="^0.11" installed="0.12.0" location="./tools/phpdox" copy="true"/>
<phar name="php-cs-fixer" version="^2.15" installed="2.15.3" location="./tools/php-cs-fixer" copy="true"/>
<phar name="phpdox" version="^0.12" installed="0.12.0" location="./tools/phpdox" copy="true"/>
<phar name="phploc" version="^4.0" installed="4.0.1" location="./tools/phploc" copy="true"/>
<phar name="psalm" version="^3.5" installed="3.5.1" location="./tools/psalm" copy="true"/>
<phar name="psalm" version="^3.6" installed="3.6.2" location="./tools/psalm" copy="true"/>
</phive>
2 changes: 1 addition & 1 deletion phpunit.xsd
Expand Up @@ -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 8.4 may be structured.
This Schema file defines the rules by which the XML configuration file of PHPUnit 8.5 may be structured.
</xs:documentation>
<xs:appinfo source="https://phpunit.de/documentation.html"/>
</xs:annotation>
Expand Down
8 changes: 4 additions & 4 deletions src/Framework/Constraint/Count.php
Expand Up @@ -49,14 +49,14 @@ protected function matches($other): bool
*/
protected function getCountOf($other): ?int
{
if ($other instanceof \EmptyIterator) {
return 0;
}

if ($other instanceof Countable || \is_array($other)) {
return \count($other);
}

if ($other instanceof \EmptyIterator) {
return 0;
}

if ($other instanceof Traversable) {
while ($other instanceof IteratorAggregate) {
$other = $other->getIterator();
Expand Down
4 changes: 2 additions & 2 deletions src/Framework/Exception/Exception.php
Expand Up @@ -46,8 +46,8 @@ public function __construct($message = '', $code = 0, \Throwable $previous = nul

$this->serializableTrace = $this->getTrace();

foreach ($this->serializableTrace as $i => $call) {
unset($this->serializableTrace[$i]['args']);
foreach (\array_keys($this->serializableTrace) as $key) {
unset($this->serializableTrace[$key]['args']);
}
}

Expand Down
Expand Up @@ -9,6 +9,9 @@
*/
namespace PHPUnit\Framework;

final class UnexpectedValueException extends Exception
/**
* @internal This class is not covered by the backward compatibility promise for PHPUnit
*/
final class NoChildTestSuiteException extends Exception
{
}
4 changes: 2 additions & 2 deletions src/Framework/ExceptionWrapper.php
Expand Up @@ -83,8 +83,8 @@ public function setOriginalException(\Throwable $t): void

$this->serializableTrace = $t->getTrace();

foreach ($this->serializableTrace as $i => $call) {
unset($this->serializableTrace[$i]['args']);
foreach (\array_keys($this->serializableTrace) as $key) {
unset($this->serializableTrace[$key]['args']);
}

if ($t->getPrevious()) {
Expand Down
1 change: 0 additions & 1 deletion src/Framework/MockObject/Builder/InvocationStubber.php
Expand Up @@ -11,7 +11,6 @@

use PHPUnit\Framework\MockObject\Stub\Stub;

/** @internal This class is not covered by the backward compatibility promise for PHPUnit */
interface InvocationStubber
{
public function will(Stub $stub): Identity;
Expand Down
2 changes: 2 additions & 0 deletions src/Framework/TestBuilder.php
Expand Up @@ -131,11 +131,13 @@ private function appendExceptionMessageIfAvailable(\Throwable $e, string $messag
return $message;
}

/** @psalm-param class-string $className */
private function buildTestWithoutData(string $className)
{
return new $className;
}

/** @psalm-param class-string $className */
private function buildDataProviderTestSuite(
string $methodName,
string $className,
Expand Down
37 changes: 17 additions & 20 deletions src/Framework/TestCase.php
Expand Up @@ -1557,7 +1557,7 @@ protected function createStub(string $originalClassName): Stub
}

/**
* Returns a test double for the specified class.
* Returns a mock object for the specified class.
*
* @param string|string[] $originalClassName
*
Expand All @@ -1576,7 +1576,7 @@ protected function createMock($originalClassName): MockObject
}

/**
* Returns a configured test double for the specified class.
* Returns a configured mock object for the specified class.
*
* @param string|string[] $originalClassName
*
Expand All @@ -1596,7 +1596,7 @@ protected function createConfiguredMock($originalClassName, array $configuration
}

/**
* Returns a partial test double for the specified class.
* Returns a partial mock object for the specified class.
*
* @param string|string[] $originalClassName
* @param string[] $methods
Expand All @@ -1612,9 +1612,12 @@ protected function createPartialMock($originalClassName, array $methods): MockOb
foreach ($class_names as $class_name) {
$reflection = new \ReflectionClass($class_name);

$mockedMethodsThatDontExist = \array_filter($methods, function (string $method) use ($reflection) {
return !$reflection->hasMethod($method);
});
$mockedMethodsThatDontExist = \array_filter(
$methods,
static function (string $method) use ($reflection) {
return !$reflection->hasMethod($method);
}
);

if ($mockedMethodsThatDontExist) {
$this->addWarning(
Expand Down Expand Up @@ -1954,23 +1957,17 @@ private function verifyMockObjects(): void
if ($this->prophet !== null) {
try {
$this->prophet->checkPredictions();
} catch (\Throwable $t) {
/* Intentionally left empty */
}

foreach ($this->prophet->getProphecies() as $objectProphecy) {
foreach ($objectProphecy->getMethodProphecies() as $methodProphecies) {
foreach ($methodProphecies as $methodProphecy) {
\assert($methodProphecy instanceof MethodProphecy);

$this->numAssertions += \count($methodProphecy->getCheckedPredictions());
} finally {
foreach ($this->prophet->getProphecies() as $objectProphecy) {
foreach ($objectProphecy->getMethodProphecies() as $methodProphecies) {
foreach ($methodProphecies as $methodProphecy) {
\assert($methodProphecy instanceof MethodProphecy);

$this->numAssertions += \count($methodProphecy->getCheckedPredictions());
}
}
}
}

if (isset($t)) {
throw $t;
}
}
}

Expand Down

0 comments on commit 4a7d508

Please sign in to comment.