Skip to content

Commit

Permalink
Closes #5311
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Feb 27, 2024
1 parent 7d8c587 commit 9ba4d35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 48 deletions.
57 changes: 10 additions & 47 deletions src/Framework/MockObject/MockBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ final class MockBuilder
/**
* @psalm-var ?class-string
*/
private ?string $mockClassName = null;
private array $constructorArgs = [];
private bool $originalConstructor = true;
private bool $originalClone = true;
private bool $autoload = true;
private bool $cloneArguments = false;
private bool $callOriginalMethods = false;
private ?object $proxyTarget = null;
private bool $allowMockingUnknownTypes = true;
private bool $returnValueGeneration = true;
private ?string $mockClassName = null;
private array $constructorArgs = [];
private bool $originalConstructor = true;
private bool $originalClone = true;
private bool $autoload = true;
private bool $cloneArguments = false;
private bool $callOriginalMethods = false;
private ?object $proxyTarget = null;
private bool $returnValueGeneration = true;
private readonly Generator $generator;

/**
Expand Down Expand Up @@ -105,7 +104,7 @@ public function getMock(): MockObject
$this->cloneArguments,
$this->callOriginalMethods,
$this->proxyTarget,
$this->allowMockingUnknownTypes,
false,
$this->returnValueGeneration,
);

Expand Down Expand Up @@ -310,42 +309,6 @@ public function enableArgumentCloning(): self
return $this;
}

/**
* @return $this
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/5308
*/
public function allowMockingUnknownTypes(): self
{
EventFacade::emitter()->testTriggeredPhpunitDeprecation(
$this->testCase->valueObjectForEvents(),
'MockBuilder::allowMockingUnknownTypes() is deprecated and will be removed in PHPUnit 12 without replacement.',
);

$this->allowMockingUnknownTypes = true;

return $this;
}

/**
* @return $this
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/5308
*/
public function disallowMockingUnknownTypes(): self
{
if (!$this->calledFromTestCase()) {
EventFacade::emitter()->testTriggeredPhpunitDeprecation(
$this->testCase->valueObjectForEvents(),
'MockBuilder::disallowMockingUnknownTypes() is deprecated and will be removed in PHPUnit 12 without replacement.',
);
}

$this->allowMockingUnknownTypes = false;

return $this;
}

/**
* @return $this
*/
Expand Down
1 change: 0 additions & 1 deletion src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,6 @@ final protected function createPartialMock(string $originalClassName, array $met
->disableOriginalConstructor()
->disableOriginalClone()
->disableArgumentCloning()
->disallowMockingUnknownTypes()
->onlyMethods($methods);

if (!self::generateReturnValuesForTestDoubles()) {
Expand Down

0 comments on commit 9ba4d35

Please sign in to comment.