Skip to content

Commit

Permalink
Closes #5246
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 6, 2024
1 parent efa5bf8 commit 26d505b
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 276 deletions.
1 change: 1 addition & 0 deletions ChangeLog-12.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes of the PHPUnit 12.0 release series are documented in this fi

### Removed

* [#5246](https://github.com/sebastianbergmann/phpunit/issues/5246): `TestCase::createTestProxy()`
* [#5247](https://github.com/sebastianbergmann/phpunit/issues/5247): `TestCase::getMockForAbstractClass()`
* [#5248](https://github.com/sebastianbergmann/phpunit/issues/5248): `TestCase::getMockFromWsdl()`
* [#5249](https://github.com/sebastianbergmann/phpunit/issues/5249): `TestCase::getMockForTrait()`
Expand Down
1 change: 0 additions & 1 deletion DEPRECATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ This functionality is currently [hard-deprecated](https://phpunit.de/backward-co

| Issue | Description | Since | Replacement |
|-------------------------------------------------------------------|--------------------------------------------------------------------------------|--------|-----------------------------------------------------------------------------------------|
| [#5240](https://github.com/sebastianbergmann/phpunit/issues/5240) | `TestCase::createTestProxy()` | 10.1.0 | |
| [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307) | `MockBuilder::disableProxyingToOriginalMethods()` | 10.1.0 | |
| [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307) | `MockBuilder::enableProxyingToOriginalMethods()` | 10.1.0 | |
| [#5307](https://github.com/sebastianbergmann/phpunit/issues/5307) | `MockBuilder::setProxyTarget()` | 10.1.0 | |
Expand Down
19 changes: 0 additions & 19 deletions src/Event/Emitter/DispatchingEmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
use PHPUnit\Event\TestSuite\Started as TestSuiteStarted;
use PHPUnit\Event\TestSuite\TestSuite;
use PHPUnit\TextUI\Configuration\Configuration;
use PHPUnit\Util\Exporter;

/**
* @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
Expand Down Expand Up @@ -518,24 +517,6 @@ public function testCreatedPartialMockObject(string $className, string ...$metho
);
}

/**
* @param class-string $className
* @param list<mixed> $constructorArguments
*
* @throws InvalidArgumentException
* @throws UnknownEventTypeException
*/
public function testCreatedTestProxy(string $className, array $constructorArguments): void
{
$this->dispatcher->dispatch(
new Test\TestProxyCreated(
$this->telemetryInfo(),
$className,
Exporter::export($constructorArguments),
),
);
}

/**
* @param class-string $className
*
Expand Down
6 changes: 0 additions & 6 deletions src/Event/Emitter/Emitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,6 @@ public function testCreatedMockObjectForIntersectionOfInterfaces(array $interfac
*/
public function testCreatedPartialMockObject(string $className, string ...$methodNames): void;

/**
* @param class-string $className
* @param list<mixed> $constructorArguments
*/
public function testCreatedTestProxy(string $className, array $constructorArguments): void;

/**
* @param class-string $className
*/
Expand Down
66 changes: 0 additions & 66 deletions src/Event/Events/Test/TestDouble/TestProxyCreated.php

This file was deleted.

20 changes: 0 additions & 20 deletions src/Event/Events/Test/TestDouble/TestProxyCreatedSubscriber.php

This file was deleted.

1 change: 0 additions & 1 deletion src/Event/Facade.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ private function registerDefaultTypes(TypeMap $typeMap): void
Test\MockObjectCreated::class,
Test\MockObjectForIntersectionOfInterfacesCreated::class,
Test\PartialMockObjectCreated::class,
Test\TestProxyCreated::class,
Test\TestStubCreated::class,
Test\TestStubForIntersectionOfInterfacesCreated::class,

Expand Down
35 changes: 0 additions & 35 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
41 changes: 0 additions & 41 deletions tests/unit/Event/Emitter/DispatchingEmitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1146,47 +1146,6 @@ public function notify(Test\PartialMockObjectCreated $event): void
$this->assertSame($methodNames, $event->methodNames());
}

public function testTestTestProxyCreatedDispatchesTestDoubleTestProxyCreatedEvent(): void
{
$className = self::class;
$constructorArguments = ['foo'];

$subscriber = new class extends RecordingSubscriber implements Test\TestProxyCreatedSubscriber
{
public function notify(Test\TestProxyCreated $event): void
{
$this->record($event);
}
};

$dispatcher = $this->dispatcherWithRegisteredSubscriber(
Test\TestProxyCreatedSubscriber::class,
Test\TestProxyCreated::class,
$subscriber,
);

$telemetrySystem = $this->telemetrySystem();

$emitter = new DispatchingEmitter(
$dispatcher,
$telemetrySystem,
);

$emitter->testCreatedTestProxy(
$className,
$constructorArguments,
);

$this->assertSame(1, $subscriber->recordedEventCount());

$event = $subscriber->lastRecordedEvent();

$this->assertInstanceOf(Test\TestProxyCreated::class, $event);

$this->assertSame($className, $event->className());
$this->assertSame("Array &0 [\n 0 => 'foo',\n]", $event->constructorArguments());
}

public function testTestTestStubCreatedDispatchesTestDoubleTestStubCreatedEvent(): void
{
$className = self::class;
Expand Down
47 changes: 0 additions & 47 deletions tests/unit/Event/Events/TestDouble/TestProxyCreatedTest.php

This file was deleted.

40 changes: 0 additions & 40 deletions tests/unit/Framework/MockObject/Creation/CreateTestProxyTest.php

This file was deleted.

0 comments on commit 26d505b

Please sign in to comment.