Skip to content

Commit

Permalink
Closes #5313
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jul 19, 2024
1 parent 38d824e commit b71ab34
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions src/Framework/MockObject/MockBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use function array_merge;
use function assert;
use function debug_backtrace;
use function trait_exists;
use PHPUnit\Event\Facade as EventFacade;
use PHPUnit\Framework\Exception;
use PHPUnit\Framework\InvalidArgumentException;
Expand Down Expand Up @@ -123,44 +122,6 @@ public function getMock(): MockObject
return $object;
}

/**
* Creates a mock object for a trait using a fluent interface.
*
* @throws Exception
* @throws ReflectionException
* @throws RuntimeException
*
* @return MockedType&MockObject
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/5306
*/
public function getMockForTrait(): MockObject
{
EventFacade::emitter()->testTriggeredPhpunitDeprecation(
$this->testCase->valueObjectForEvents(),
'MockBuilder::getMockForTrait() is deprecated and will be removed in PHPUnit 12 without replacement.',
);

assert(trait_exists($this->type));

$object = $this->generator->mockObjectForTrait(
$this->type,
$this->constructorArgs,
$this->mockClassName ?? '',
$this->originalConstructor,
$this->originalClone,
$this->autoload,
$this->methods,
$this->cloneArguments,
);

assert($object instanceof MockObject);

$this->testCase->registerMockObject($object);

return $object;
}

/**
* Specifies the subset of methods to mock, requiring each to exist in the class.
*
Expand Down

0 comments on commit b71ab34

Please sign in to comment.