Skip to content

Commit

Permalink
Closes #5246
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Jul 19, 2024
1 parent 52306f2 commit 41a90cd
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 91 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"])
);
}
35 changes: 0 additions & 35 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1436,41 +1436,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;
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 41a90cd

Please sign in to comment.