Skip to content

Commit

Permalink
Closes #5246
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Mar 2, 2024
1 parent 30fcbbe commit cd4bfed
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 90 deletions.
5 changes: 0 additions & 5 deletions .phpstorm.meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,4 @@
\PHPUnit\Framework\TestCase::createPartialMock(0),
map([""=>"$0"])
);

override(
\PHPUnit\Framework\TestCase::createTestProxy(0),
map([""=>"$0"])
);
}
34 changes: 0 additions & 34 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1381,40 +1381,6 @@ final protected function createPartialMock(string $originalClassName, array $met
return $partialMock;
}

/**
* Creates a test proxy for the specified class.
*
* @psalm-template RealInstanceType of object
*
* @psalm-param class-string<RealInstanceType> $originalClassName
*
* @psalm-return MockObject&RealInstanceType
*
* @throws InvalidArgumentException
* @throws MockObjectException
*
* @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;
Expand Down
11 changes: 0 additions & 11 deletions tests/static-analysis/TestUsingMocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 0 additions & 40 deletions tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php

This file was deleted.

0 comments on commit cd4bfed

Please sign in to comment.