Skip to content
Permalink
Browse files

Merge branch '8.3'

  • Loading branch information...
sebastianbergmann committed Aug 3, 2019
2 parents 54dc71f + 27d698e commit 4f54484fdd3dc6585b8f8f4a7264ab2fe9566897
@@ -196,7 +196,6 @@ return PhpCsFixer\Config::create()
->setFinder(
PhpCsFixer\Finder::create()
->files()
->in(__DIR__ . '/build')
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests/_files')
->in(__DIR__ . '/tests/basic')
@@ -198,7 +198,7 @@
<PossiblyInvalidPropertyAssignmentValue occurrences="1">
<code>$type</code>
</PossiblyInvalidPropertyAssignmentValue>
<PossiblyNullPropertyAssignmentValue occurrences="1">
<PossiblyNullPropertyAssignmentValue occurrences="3">
<code>null</code>
</PossiblyNullPropertyAssignmentValue>
<ArgumentTypeCoercion occurrences="2">
@@ -2,6 +2,12 @@

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

## [8.3.3] - 2019-MM-DD

### Fixed

* Implemented [#3781](https://github.com/sebastianbergmann/phpunit/pull/3781): `MockBuilder::addMethods()` and `MockBuilder::onlyMethods()` do not handle empty parameter array correctly

## [8.3.2] - 2019-08-02

### Fixed
@@ -31,6 +37,7 @@ All notable changes of the PHPUnit 8.3 release series are documented in this fil
* Implemented [#3522](https://github.com/sebastianbergmann/phpunit/issues/3522): The `TestCase::setUseErrorHandler()` method, which controlled a feature that was not documented and did not work correctly, has been deprecated and does not have an effect anymore
* Implemented [#3687](https://github.com/sebastianbergmann/phpunit/pull/3687): `MockBuilder::setMethods()` is now deprecated

[8.3.3]: https://github.com/sebastianbergmann/phpunit/compare/8.3.2...8.3.3
[8.3.2]: https://github.com/sebastianbergmann/phpunit/compare/8.3.1...8.3.2
[8.3.1]: https://github.com/sebastianbergmann/phpunit/compare/8.3.0...8.3.1
[8.3.0]: https://github.com/sebastianbergmann/phpunit/compare/8.2.5...8.3.0
@@ -27,7 +27,7 @@ final class MockBuilder
private $type;
/**
* @var string[]
* @var null|string[]
*/
private $methods = [];
@@ -207,6 +207,12 @@ public function setMethods(array $methods = null): self
*/
public function onlyMethods(array $methods): self
{
if (empty($methods)) {
$this->methods = null;
return $this;
}
if ($this->alreadyUsedMockMethodConfiguration) {
throw new RuntimeException(
\sprintf(
@@ -254,6 +260,12 @@ public function onlyMethods(array $methods): self
*/
public function addMethods(array $methods): self
{
if (empty($methods)) {
$this->methods = null;
return $this;
}
if ($this->alreadyUsedMockMethodConfiguration) {
throw new RuntimeException(
\sprintf(
@@ -44,8 +44,8 @@ public function testMethodsToMockCanBeSpecified(): void
public function testMethodExceptionsToMockCanBeSpecified(): void
{
$mock = $this->getMockBuilder(Mockable::class)
->setMethodsExcept(['mockableMethod'])
->getMock();
->setMethodsExcept(['mockableMethod'])
->getMock();
$this->assertTrue($mock->mockableMethod());
$this->assertNull($mock->anotherMockableMethod());
@@ -79,6 +79,15 @@ public function testOnlyMethodsWithExistingMethodNames(): void
$this->assertTrue($mock->anotherMockableMethod());
}
public function testOnlyMethodsWithEmptyArray(): void
{
$mock = $this->getMockBuilder(Mockable::class)
->onlyMethods([])
->getMock();
$this->assertTrue($mock->mockableMethod());
}
public function testAddMethodsWithNonExistentMethodNames(): void
{
$this->expectException(RuntimeException::class);
@@ -98,11 +107,20 @@ public function testAddMethodsWithExistingMethodNames(): void
$this->assertTrue($mock->anotherMockableMethod());
}
public function testAddMethodsWithEmptyArray(): void
{
$mock = $this->getMockBuilder(Mockable::class)
->addMethods([])
->getMock();
$this->assertTrue($mock->mockableMethod());
}
public function testEmptyMethodExceptionsToMockCanBeSpecified(): void
{
$mock = $this->getMockBuilder(Mockable::class)
->setMethodsExcept()
->getMock();
->setMethodsExcept()
->getMock();
$this->assertNull($mock->mockableMethod());
$this->assertNull($mock->anotherMockableMethod());
BIN +16.5 KB (100%) tools/composer
Binary file not shown.

0 comments on commit 4f54484

Please sign in to comment.
You can’t perform that action at this time.