Skip to content

Commit

Permalink
Closes #5313
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Feb 19, 2024
1 parent ba97d02 commit e749223
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 @@ -12,7 +12,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\InvalidArgumentException;
use PHPUnit\Framework\MockObject\Generator\ClassAlreadyExistsException;
Expand Down Expand Up @@ -118,44 +117,6 @@ public function getMock(): MockObject
return $object;
}

/**
* Creates a mock object for a trait using a fluent interface.
*
* @psalm-return MockObject&MockedType
*
* @throws \PHPUnit\Framework\Exception
* @throws ReflectionException
* @throws RuntimeException
*
* @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 e749223

Please sign in to comment.