From 90bbf2c3874c7d2e214a49ac58ac34e515f8acdb Mon Sep 17 00:00:00 2001 From: Sebastian Bergmann Date: Wed, 7 Feb 2024 18:04:59 +0100 Subject: [PATCH] Delete events that are no longer emitted --- .psalm/baseline.xml | 5 - src/Event/Emitter/DispatchingEmitter.php | 72 -------- src/Event/Emitter/Emitter.php | 21 --- .../MockObjectForAbstractClassCreated.php | 59 ------ ...bjectForAbstractClassCreatedSubscriber.php | 20 -- .../TestDouble/MockObjectForTraitCreated.php | 59 ------ .../MockObjectForTraitCreatedSubscriber.php | 20 -- .../TestDouble/MockObjectFromWsdlCreated.php | 109 ----------- .../MockObjectFromWsdlCreatedSubscriber.php | 20 -- .../Test/TestDouble/TestProxyCreated.php | 66 ------- .../TestDouble/TestProxyCreatedSubscriber.php | 20 -- src/Event/Facade.php | 4 - .../Event/Emitter/DispatchingEmitterTest.php | 174 ------------------ .../MockObjectForAbstractClassCreatedTest.php | 43 ----- .../MockObjectForTraitCreatedTest.php | 43 ----- .../MockObjectFromWsdlCreatedTest.php | 70 ------- .../TestDouble/TestProxyCreatedTest.php | 47 ----- 17 files changed, 852 deletions(-) delete mode 100644 src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreated.php delete mode 100644 src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreatedSubscriber.php delete mode 100644 src/Event/Events/Test/TestDouble/MockObjectForTraitCreated.php delete mode 100644 src/Event/Events/Test/TestDouble/MockObjectForTraitCreatedSubscriber.php delete mode 100644 src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreated.php delete mode 100644 src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreatedSubscriber.php delete mode 100644 src/Event/Events/Test/TestDouble/TestProxyCreated.php delete mode 100644 src/Event/Events/Test/TestDouble/TestProxyCreatedSubscriber.php delete mode 100644 tests/unit/Event/Events/TestDouble/MockObjectForAbstractClassCreatedTest.php delete mode 100644 tests/unit/Event/Events/TestDouble/MockObjectForTraitCreatedTest.php delete mode 100644 tests/unit/Event/Events/TestDouble/MockObjectFromWsdlCreatedTest.php delete mode 100644 tests/unit/Event/Events/TestDouble/TestProxyCreatedTest.php diff --git a/.psalm/baseline.xml b/.psalm/baseline.xml index 3fd4894f57c..9d9453e11ae 100644 --- a/.psalm/baseline.xml +++ b/.psalm/baseline.xml @@ -45,11 +45,6 @@ - - - - - diff --git a/src/Event/Emitter/DispatchingEmitter.php b/src/Event/Emitter/DispatchingEmitter.php index 53c5022a285..f2565a70937 100644 --- a/src/Event/Emitter/DispatchingEmitter.php +++ b/src/Event/Emitter/DispatchingEmitter.php @@ -27,7 +27,6 @@ use PHPUnit\Event\TestSuite\Started as TestSuiteStarted; use PHPUnit\Event\TestSuite\TestSuite; use PHPUnit\TextUI\Configuration\Configuration; -use SebastianBergmann\Exporter\Exporter; /** * @internal This class is not covered by the backward compatibility promise for PHPUnit @@ -499,60 +498,6 @@ public function testCreatedMockObjectForIntersectionOfInterfaces(array $interfac ); } - /** - * @psalm-param trait-string $traitName - * - * @throws InvalidArgumentException - * @throws UnknownEventTypeException - */ - public function testCreatedMockObjectForTrait(string $traitName): void - { - $this->dispatcher->dispatch( - new Test\MockObjectForTraitCreated( - $this->telemetryInfo(), - $traitName, - ), - ); - } - - /** - * @psalm-param class-string $className - * - * @throws InvalidArgumentException - * @throws UnknownEventTypeException - */ - public function testCreatedMockObjectForAbstractClass(string $className): void - { - $this->dispatcher->dispatch( - new Test\MockObjectForAbstractClassCreated( - $this->telemetryInfo(), - $className, - ), - ); - } - - /** - * @psalm-param class-string $originalClassName - * @psalm-param class-string $mockClassName - * - * @throws InvalidArgumentException - * @throws UnknownEventTypeException - */ - public function testCreatedMockObjectFromWsdl(string $wsdlFile, string $originalClassName, string $mockClassName, array $methods, bool $callOriginalConstructor, array $options): void - { - $this->dispatcher->dispatch( - new Test\MockObjectFromWsdlCreated( - $this->telemetryInfo(), - $wsdlFile, - $originalClassName, - $mockClassName, - $methods, - $callOriginalConstructor, - $options, - ), - ); - } - /** * @psalm-param class-string $className * @@ -570,23 +515,6 @@ public function testCreatedPartialMockObject(string $className, string ...$metho ); } - /** - * @psalm-param class-string $className - * - * @throws InvalidArgumentException - * @throws UnknownEventTypeException - */ - public function testCreatedTestProxy(string $className, array $constructorArguments): void - { - $this->dispatcher->dispatch( - new Test\TestProxyCreated( - $this->telemetryInfo(), - $className, - (new Exporter)->export($constructorArguments), - ), - ); - } - /** * @psalm-param class-string $className * diff --git a/src/Event/Emitter/Emitter.php b/src/Event/Emitter/Emitter.php index 8c1aa09c970..613bd66da70 100644 --- a/src/Event/Emitter/Emitter.php +++ b/src/Event/Emitter/Emitter.php @@ -115,32 +115,11 @@ public function testCreatedMockObject(string $className): void; */ public function testCreatedMockObjectForIntersectionOfInterfaces(array $interfaces): void; - /** - * @psalm-param trait-string $traitName - */ - public function testCreatedMockObjectForTrait(string $traitName): void; - - /** - * @psalm-param class-string $className - */ - public function testCreatedMockObjectForAbstractClass(string $className): void; - - /** - * @psalm-param class-string $originalClassName - * @psalm-param class-string $mockClassName - */ - public function testCreatedMockObjectFromWsdl(string $wsdlFile, string $originalClassName, string $mockClassName, array $methods, bool $callOriginalConstructor, array $options): void; - /** * @psalm-param class-string $className */ public function testCreatedPartialMockObject(string $className, string ...$methodNames): void; - /** - * @psalm-param class-string $className - */ - public function testCreatedTestProxy(string $className, array $constructorArguments): void; - /** * @psalm-param class-string $className */ diff --git a/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreated.php b/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreated.php deleted file mode 100644 index 115f1be106d..00000000000 --- a/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreated.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use function sprintf; -use PHPUnit\Event\Event; -use PHPUnit\Event\Telemetry; - -/** - * @psalm-immutable - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final readonly class MockObjectForAbstractClassCreated implements Event -{ - private Telemetry\Info $telemetryInfo; - - /** - * @psalm-var class-string - */ - private string $className; - - /** - * @psalm-param class-string $className - */ - public function __construct(Telemetry\Info $telemetryInfo, string $className) - { - $this->telemetryInfo = $telemetryInfo; - $this->className = $className; - } - - public function telemetryInfo(): Telemetry\Info - { - return $this->telemetryInfo; - } - - /** - * @psalm-return class-string - */ - public function className(): string - { - return $this->className; - } - - public function asString(): string - { - return sprintf( - 'Mock Object Created (%s)', - $this->className, - ); - } -} diff --git a/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreatedSubscriber.php b/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreatedSubscriber.php deleted file mode 100644 index c335d1917d7..00000000000 --- a/src/Event/Events/Test/TestDouble/MockObjectForAbstractClassCreatedSubscriber.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use PHPUnit\Event\Subscriber; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -interface MockObjectForAbstractClassCreatedSubscriber extends Subscriber -{ - public function notify(MockObjectForAbstractClassCreated $event): void; -} diff --git a/src/Event/Events/Test/TestDouble/MockObjectForTraitCreated.php b/src/Event/Events/Test/TestDouble/MockObjectForTraitCreated.php deleted file mode 100644 index fe58c57d715..00000000000 --- a/src/Event/Events/Test/TestDouble/MockObjectForTraitCreated.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use function sprintf; -use PHPUnit\Event\Event; -use PHPUnit\Event\Telemetry; - -/** - * @psalm-immutable - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final readonly class MockObjectForTraitCreated implements Event -{ - private Telemetry\Info $telemetryInfo; - - /** - * @psalm-var trait-string - */ - private string $traitName; - - /** - * @psalm-param trait-string $traitName - */ - public function __construct(Telemetry\Info $telemetryInfo, string $traitName) - { - $this->telemetryInfo = $telemetryInfo; - $this->traitName = $traitName; - } - - public function telemetryInfo(): Telemetry\Info - { - return $this->telemetryInfo; - } - - /** - * @psalm-return trait-string - */ - public function traitName(): string - { - return $this->traitName; - } - - public function asString(): string - { - return sprintf( - 'Mock Object Created (%s)', - $this->traitName, - ); - } -} diff --git a/src/Event/Events/Test/TestDouble/MockObjectForTraitCreatedSubscriber.php b/src/Event/Events/Test/TestDouble/MockObjectForTraitCreatedSubscriber.php deleted file mode 100644 index a7e7dd07c1c..00000000000 --- a/src/Event/Events/Test/TestDouble/MockObjectForTraitCreatedSubscriber.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use PHPUnit\Event\Subscriber; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -interface MockObjectForTraitCreatedSubscriber extends Subscriber -{ - public function notify(MockObjectForTraitCreated $event): void; -} diff --git a/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreated.php b/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreated.php deleted file mode 100644 index 5eda4b8a37d..00000000000 --- a/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreated.php +++ /dev/null @@ -1,109 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use function sprintf; -use PHPUnit\Event\Event; -use PHPUnit\Event\Telemetry; - -/** - * @psalm-immutable - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final readonly class MockObjectFromWsdlCreated implements Event -{ - private Telemetry\Info $telemetryInfo; - private string $wsdlFile; - - /** - * @psalm-var class-string - */ - private string $originalClassName; - - /** - * @psalm-var class-string - */ - private string $mockClassName; - - /** - * @psalm-var list - */ - private array $methods; - private bool $callOriginalConstructor; - private array $options; - - /** - * @psalm-param class-string $originalClassName - * @psalm-param class-string $mockClassName - */ - public function __construct(Telemetry\Info $telemetryInfo, string $wsdlFile, string $originalClassName, string $mockClassName, array $methods, bool $callOriginalConstructor, array $options) - { - $this->telemetryInfo = $telemetryInfo; - $this->wsdlFile = $wsdlFile; - $this->originalClassName = $originalClassName; - $this->mockClassName = $mockClassName; - $this->methods = $methods; - $this->callOriginalConstructor = $callOriginalConstructor; - $this->options = $options; - } - - public function telemetryInfo(): Telemetry\Info - { - return $this->telemetryInfo; - } - - public function wsdlFile(): string - { - return $this->wsdlFile; - } - - /** - * @psalm-return class-string - */ - public function originalClassName(): string - { - return $this->originalClassName; - } - - /** - * @psalm-return class-string - */ - public function mockClassName(): string - { - return $this->mockClassName; - } - - /** - * @psalm-return list - */ - public function methods(): array - { - return $this->methods; - } - - public function callOriginalConstructor(): bool - { - return $this->callOriginalConstructor; - } - - public function options(): array - { - return $this->options; - } - - public function asString(): string - { - return sprintf( - 'Mock Object Created (%s)', - $this->wsdlFile, - ); - } -} diff --git a/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreatedSubscriber.php b/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreatedSubscriber.php deleted file mode 100644 index fb0524b21a0..00000000000 --- a/src/Event/Events/Test/TestDouble/MockObjectFromWsdlCreatedSubscriber.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use PHPUnit\Event\Subscriber; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -interface MockObjectFromWsdlCreatedSubscriber extends Subscriber -{ - public function notify(MockObjectFromWsdlCreated $event): void; -} diff --git a/src/Event/Events/Test/TestDouble/TestProxyCreated.php b/src/Event/Events/Test/TestDouble/TestProxyCreated.php deleted file mode 100644 index 4cd4545b976..00000000000 --- a/src/Event/Events/Test/TestDouble/TestProxyCreated.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use function sprintf; -use PHPUnit\Event\Event; -use PHPUnit\Event\Telemetry; - -/** - * @psalm-immutable - * - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -final readonly class TestProxyCreated implements Event -{ - private Telemetry\Info $telemetryInfo; - - /** - * @psalm-var class-string - */ - private string $className; - private string $constructorArguments; - - /** - * @psalm-param class-string $className - */ - public function __construct(Telemetry\Info $telemetryInfo, string $className, string $constructorArguments) - { - $this->telemetryInfo = $telemetryInfo; - $this->className = $className; - $this->constructorArguments = $constructorArguments; - } - - public function telemetryInfo(): Telemetry\Info - { - return $this->telemetryInfo; - } - - /** - * @psalm-return class-string - */ - public function className(): string - { - return $this->className; - } - - public function constructorArguments(): string - { - return $this->constructorArguments; - } - - public function asString(): string - { - return sprintf( - 'Test Proxy Created (%s)', - $this->className, - ); - } -} diff --git a/src/Event/Events/Test/TestDouble/TestProxyCreatedSubscriber.php b/src/Event/Events/Test/TestDouble/TestProxyCreatedSubscriber.php deleted file mode 100644 index 8af83844a80..00000000000 --- a/src/Event/Events/Test/TestDouble/TestProxyCreatedSubscriber.php +++ /dev/null @@ -1,20 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use PHPUnit\Event\Subscriber; - -/** - * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit - */ -interface TestProxyCreatedSubscriber extends Subscriber -{ - public function notify(TestProxyCreated $event): void; -} diff --git a/src/Event/Facade.php b/src/Event/Facade.php index aad8d6846c1..d7de9022d92 100644 --- a/src/Event/Facade.php +++ b/src/Event/Facade.php @@ -207,12 +207,8 @@ private function registerDefaultTypes(TypeMap $typeMap): void Test\WarningTriggered::class, Test\MockObjectCreated::class, - Test\MockObjectForAbstractClassCreated::class, Test\MockObjectForIntersectionOfInterfacesCreated::class, - Test\MockObjectForTraitCreated::class, - Test\MockObjectFromWsdlCreated::class, Test\PartialMockObjectCreated::class, - Test\TestProxyCreated::class, Test\TestStubCreated::class, Test\TestStubForIntersectionOfInterfacesCreated::class, diff --git a/tests/unit/Event/Emitter/DispatchingEmitterTest.php b/tests/unit/Event/Emitter/DispatchingEmitterTest.php index 825436db3eb..c68d2d10bd9 100644 --- a/tests/unit/Event/Emitter/DispatchingEmitterTest.php +++ b/tests/unit/Event/Emitter/DispatchingEmitterTest.php @@ -35,9 +35,7 @@ use PHPUnit\Framework; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Metadata\MetadataCollection; -use PHPUnit\TestFixture; use PHPUnit\TestFixture\RecordingSubscriber; -use stdClass; #[CoversClass(DispatchingEmitter::class)] final class DispatchingEmitterTest extends Framework\TestCase @@ -1105,137 +1103,6 @@ public function notify(Test\MockObjectCreated $event): void $this->assertSame($className, $event->className()); } - public function testTestMockObjectCreatedForTraitDispatchesTestDoubleMockObjectCreatedForTraitEvent(): void - { - $traitName = TestFixture\MockObject\ExampleTrait::class; - - $subscriber = new class extends RecordingSubscriber implements Test\MockObjectForTraitCreatedSubscriber - { - public function notify(Test\MockObjectForTraitCreated $event): void - { - $this->record($event); - } - }; - - $dispatcher = $this->dispatcherWithRegisteredSubscriber( - Test\MockObjectForTraitCreatedSubscriber::class, - Test\MockObjectForTraitCreated::class, - $subscriber, - ); - - $telemetrySystem = $this->telemetrySystem(); - - $emitter = new DispatchingEmitter( - $dispatcher, - $telemetrySystem, - ); - - $emitter->testCreatedMockObjectForTrait($traitName); - - $this->assertSame(1, $subscriber->recordedEventCount()); - $event = $subscriber->lastRecordedEvent(); - - $this->assertInstanceOf(Test\MockObjectForTraitCreated::class, $event); - - $this->assertSame($traitName, $event->traitName()); - } - - public function testTestMockObjectCreatedForAbstractClassDispatchesTestDoubleMockObjectCreatedForAbstractClassEvent(): void - { - $className = stdClass::class; - - $subscriber = new class extends RecordingSubscriber implements Test\MockObjectForAbstractClassCreatedSubscriber - { - public function notify(Test\MockObjectForAbstractClassCreated $event): void - { - $this->record($event); - } - }; - - $dispatcher = $this->dispatcherWithRegisteredSubscriber( - Test\MockObjectForAbstractClassCreatedSubscriber::class, - Test\MockObjectForAbstractClassCreated::class, - $subscriber, - ); - - $telemetrySystem = $this->telemetrySystem(); - - $emitter = new DispatchingEmitter( - $dispatcher, - $telemetrySystem, - ); - - $emitter->testCreatedMockObjectForAbstractClass($className); - - $this->assertSame(1, $subscriber->recordedEventCount()); - - $event = $subscriber->lastRecordedEvent(); - - $this->assertInstanceOf(Test\MockObjectForAbstractClassCreated::class, $event); - - $this->assertSame($className, $event->className()); - } - - public function testTestMockObjectCreatedFromWsdlDispatchesTestDoubleMockObjectCreatedFromWsdlEvent(): void - { - $wsdlFile = __FILE__; - $originalClassName = self::class; - $mockClassName = stdClass::class; - $methods = [ - 'foo', - 'bar', - ]; - $callOriginalConstructor = false; - $options = [ - 'foo' => 'bar', - 'bar' => 'baz', - 'baz' => 9000, - ]; - - $subscriber = new class extends RecordingSubscriber implements Test\MockObjectFromWsdlCreatedSubscriber - { - public function notify(Test\MockObjectFromWsdlCreated $event): void - { - $this->record($event); - } - }; - - $dispatcher = $this->dispatcherWithRegisteredSubscriber( - Test\MockObjectFromWsdlCreatedSubscriber::class, - Test\MockObjectFromWsdlCreated::class, - $subscriber, - ); - - $telemetrySystem = $this->telemetrySystem(); - - $emitter = new DispatchingEmitter( - $dispatcher, - $telemetrySystem, - ); - - $emitter->testCreatedMockObjectFromWsdl( - $wsdlFile, - $originalClassName, - $mockClassName, - $methods, - $callOriginalConstructor, - $options, - ); - - $this->assertSame(1, $subscriber->recordedEventCount()); - - $event = $subscriber->lastRecordedEvent(); - - $this->assertInstanceOf(Test\MockObjectFromWsdlCreated::class, $event); - - $this->assertSame($wsdlFile, $event->wsdlFile()); - $this->assertSame($originalClassName, $event->originalClassName()); - $this->assertSame($mockClassName, $event->mockClassName()); - $this->assertSame($methods, $event->methods()); - $this->assertSame($callOriginalConstructor, $event->callOriginalConstructor()); - $this->assertSame($options, $event->options()); - } - public function testTestPartialMockObjectCreatedDispatchesTestDoublePartialMockObjectCreatedEvent(): void { $className = self::class; @@ -1281,47 +1148,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; diff --git a/tests/unit/Event/Events/TestDouble/MockObjectForAbstractClassCreatedTest.php b/tests/unit/Event/Events/TestDouble/MockObjectForAbstractClassCreatedTest.php deleted file mode 100644 index cddbfb6b5c6..00000000000 --- a/tests/unit/Event/Events/TestDouble/MockObjectForAbstractClassCreatedTest.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use PHPUnit\Event\AbstractEventTestCase; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Small; - -#[CoversClass(MockObjectForAbstractClassCreated::class)] -#[Small] -final class MockObjectForAbstractClassCreatedTest extends AbstractEventTestCase -{ - public function testConstructorSetsValues(): void - { - $telemetryInfo = $this->telemetryInfo(); - $className = 'OriginalType'; - - $event = new MockObjectForAbstractClassCreated( - $telemetryInfo, - $className, - ); - - $this->assertSame($telemetryInfo, $event->telemetryInfo()); - $this->assertSame($className, $event->className()); - } - - public function testCanBeRepresentedAsString(): void - { - $event = new MockObjectForAbstractClassCreated( - $this->telemetryInfo(), - 'OriginalType', - ); - - $this->assertSame('Mock Object Created (OriginalType)', $event->asString()); - } -} diff --git a/tests/unit/Event/Events/TestDouble/MockObjectForTraitCreatedTest.php b/tests/unit/Event/Events/TestDouble/MockObjectForTraitCreatedTest.php deleted file mode 100644 index 788e5ee8913..00000000000 --- a/tests/unit/Event/Events/TestDouble/MockObjectForTraitCreatedTest.php +++ /dev/null @@ -1,43 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use PHPUnit\Event\AbstractEventTestCase; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Small; - -#[CoversClass(MockObjectForTraitCreated::class)] -#[Small] -final class MockObjectForTraitCreatedTest extends AbstractEventTestCase -{ - public function testConstructorSetsValues(): void - { - $telemetryInfo = $this->telemetryInfo(); - $traitName = 'TraitName'; - - $event = new MockObjectForTraitCreated( - $telemetryInfo, - $traitName, - ); - - $this->assertSame($telemetryInfo, $event->telemetryInfo()); - $this->assertSame($traitName, $event->traitName()); - } - - public function testCanBeRepresentedAsString(): void - { - $event = new MockObjectForTraitCreated( - $this->telemetryInfo(), - 'TraitName', - ); - - $this->assertSame('Mock Object Created (TraitName)', $event->asString()); - } -} diff --git a/tests/unit/Event/Events/TestDouble/MockObjectFromWsdlCreatedTest.php b/tests/unit/Event/Events/TestDouble/MockObjectFromWsdlCreatedTest.php deleted file mode 100644 index fda80017627..00000000000 --- a/tests/unit/Event/Events/TestDouble/MockObjectFromWsdlCreatedTest.php +++ /dev/null @@ -1,70 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use PHPUnit\Event\AbstractEventTestCase; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Small; - -#[CoversClass(MockObjectFromWsdlCreated::class)] -#[Small] -final class MockObjectFromWsdlCreatedTest extends AbstractEventTestCase -{ - public function testConstructorSetsValues(): void - { - $telemetryInfo = $this->telemetryInfo(); - $wsdlFile = 'test.wsdl'; - $originalClassName = 'OriginalClassName'; - $mockClassName = 'MockClassName'; - $methods = [ - 'foo', - 'bar', - ]; - $callOriginalConstructor = false; - $options = [ - 'foo' => 'bar', - 'bar' => 'baz', - 'baz' => 9000, - ]; - - $event = new MockObjectFromWsdlCreated( - $telemetryInfo, - $wsdlFile, - $originalClassName, - $mockClassName, - $methods, - $callOriginalConstructor, - $options, - ); - - $this->assertSame($telemetryInfo, $event->telemetryInfo()); - $this->assertSame($wsdlFile, $event->wsdlFile()); - $this->assertSame($originalClassName, $event->originalClassName()); - $this->assertSame($mockClassName, $event->mockClassName()); - $this->assertSame($methods, $event->methods()); - $this->assertSame($callOriginalConstructor, $event->callOriginalConstructor()); - $this->assertSame($options, $event->options()); - } - - public function testCanBeRepresentedAsString(): void - { - $event = new MockObjectFromWsdlCreated( - $this->telemetryInfo(), - 'test.wsdl', - 'OriginalClassName', - 'MockClassName', - [], - false, - [], - ); - - $this->assertSame('Mock Object Created (test.wsdl)', $event->asString()); - } -} diff --git a/tests/unit/Event/Events/TestDouble/TestProxyCreatedTest.php b/tests/unit/Event/Events/TestDouble/TestProxyCreatedTest.php deleted file mode 100644 index 6f22316d1d8..00000000000 --- a/tests/unit/Event/Events/TestDouble/TestProxyCreatedTest.php +++ /dev/null @@ -1,47 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ -namespace PHPUnit\Event\Test; - -use PHPUnit\Event\AbstractEventTestCase; -use PHPUnit\Framework\Attributes\CoversClass; -use PHPUnit\Framework\Attributes\Small; - -#[CoversClass(TestProxyCreated::class)] -#[Small] -final class TestProxyCreatedTest extends AbstractEventTestCase -{ - public function testConstructorSetsValues(): void - { - $telemetryInfo = $this->telemetryInfo(); - $className = 'OriginalType'; - $constructorArguments = 'exported constructor arguments'; - - $event = new TestProxyCreated( - $telemetryInfo, - $className, - $constructorArguments, - ); - - $this->assertSame($telemetryInfo, $event->telemetryInfo()); - $this->assertSame($className, $event->className()); - $this->assertSame($constructorArguments, $event->constructorArguments()); - } - - public function testCanBeRepresentedAsString(): void - { - $event = new TestProxyCreated( - $this->telemetryInfo(), - 'OriginalType', - 'exported constructor arguments', - ); - - $this->assertSame('Test Proxy Created (OriginalType)', $event->asString()); - } -}