Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #5246
Browse files Browse the repository at this point in the history
sebastianbergmann committed Sep 5, 2024

Verified

This commit was signed with the committer’s verified signature.
sebastianbergmann Sebastian Bergmann
1 parent dc4e1a4 commit 1ea1e54
Showing 3 changed files with 0 additions and 86 deletions.
35 changes: 0 additions & 35 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
@@ -1437,41 +1437,6 @@ final protected function createPartialMock(string $originalClassName, array $met
return $partialMock;
}

/**
* Creates a test proxy for the specified class.
*
* @template RealInstanceType of object
*
* @param class-string<RealInstanceType> $originalClassName
* @param array<mixed> $constructorArguments
*
* @throws InvalidArgumentException
* @throws MockObjectException
*
* @return MockObject&RealInstanceType
*
* @deprecated https://github.com/sebastianbergmann/phpunit/issues/5240
*/
final protected function createTestProxy(string $originalClassName, array $constructorArguments = []): MockObject
{
Event\Facade::emitter()->testTriggeredPhpunitDeprecation(
$this->valueObjectForEvents(),
'createTestProxy() is deprecated and will be removed in PHPUnit 12 without replacement.',
);

$testProxy = $this->getMockBuilder($originalClassName)
->setConstructorArgs($constructorArguments)
->enableProxyingToOriginalMethods()
->getMock();

Event\Facade::emitter()->testCreatedTestProxy(
$originalClassName,
$constructorArguments,
);

return $testProxy;
}

protected function transformException(Throwable $t): Throwable
{
return $t;
11 changes: 0 additions & 11 deletions tests/static-analysis/TestUsingMocks.php
Original file line number Diff line number Diff line change
@@ -68,17 +68,6 @@ public function testWillSayHelloThroughCreatePartialMock(): void
self::assertSame('hello mock!', $mock->sayHello());
}

public function testWillSayHelloThroughCreateTestProxy(): void
{
$mock = $this->createTestProxy(HelloWorldClass::class, []);

$mock
->method('sayHello')
->willReturn('hello mock!');

self::assertSame('hello mock!', $mock->sayHello());
}

public function testWillSayHelloThroughGetMockBuilder(): void
{
$mock = $this
40 changes: 0 additions & 40 deletions tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php

This file was deleted.

0 comments on commit 1ea1e54

Please sign in to comment.