Skip to content

Commit

Permalink
Rename PartialMockCreated* to PartialMockObjectCreated*
Browse files Browse the repository at this point in the history
Closes sebastianbergmann#17

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
  • Loading branch information
localheinz and theseer committed Dec 28, 2020
1 parent 7b204fa commit 5cff4bc
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/Event/DispatchingEmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,9 @@ public function testDoubleMockObjectCreatedForAbstractClass(string $className):
));
}

public function testDoublePartialMockCreated(string $className, string ...$methodNames): void
public function testDoublePartialMockObjectCreated(string $className, string ...$methodNames): void
{
$this->dispatcher->dispatch(new TestDouble\PartialMockCreated(
$this->dispatcher->dispatch(new TestDouble\PartialMockObjectCreated(
$this->telemetryInfo(),
$className,
...$methodNames
Expand Down
2 changes: 1 addition & 1 deletion src/Event/Emitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public function testDoubleMockObjectCreatedForAbstractClass(string $className):
/**
* @psalm-param class-string $className
*/
public function testDoublePartialMockCreated(string $className, string ...$methodNames): void;
public function testDoublePartialMockObjectCreated(string $className, string ...$methodNames): void;

/**
* @psalm-param class-string $className
Expand Down
2 changes: 1 addition & 1 deletion src/Event/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private static function registerDefaultTypes(TypeMap $typeMap): void
TestDouble\MockCreated::class,
TestDouble\MockObjectCreatedForAbstractClass::class,
TestDouble\MockObjectCreatedForTrait::class,
TestDouble\PartialMockCreated::class,
TestDouble\PartialMockObjectCreated::class,
TestDouble\TestProxyCreated::class,
TestSuite\AfterClassFinished::class,
TestSuite\Loaded::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use PHPUnit\Event\Event;
use PHPUnit\Event\Telemetry;

final class PartialMockCreated implements Event
final class PartialMockObjectCreated implements Event
{
private Telemetry\Info $telemetryInfo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use PHPUnit\Event\Subscriber;

interface PartialMockCreatedSubscriber extends Subscriber
interface PartialMockObjectCreatedSubscriber extends Subscriber
{
public function notify(PartialMockCreated $event): void;
public function notify(PartialMockObjectCreated $event): void;
}
2 changes: 1 addition & 1 deletion src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ protected function createPartialMock(string $originalClassName, array $methods):
->onlyMethods($methods)
->getMock();

Event\Registry::emitter()->testDoublePartialMockCreated(
Event\Registry::emitter()->testDoublePartialMockObjectCreated(
$originalClassName,
...$methods
);
Expand Down
2 changes: 1 addition & 1 deletion tests/_files/NullEmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function testDoubleMockObjectCreatedForAbstractClass(string $className):
{
}

public function testDoublePartialMockCreated(string $className, string ...$methodNames): void
public function testDoublePartialMockObjectCreated(string $className, string ...$methodNames): void
{
}

Expand Down
14 changes: 7 additions & 7 deletions tests/unit/Event/DispatchingEmitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,7 @@ public function notify(TestDouble\MockObjectCreatedForAbstractClass $event): voi
$this->assertSame($className, $event->className());
}

public function testTestDoublePartialMockCreatedDispatchesTestDoublePartialMockCreatedEvent(): void
public function testTestDoublePartialMockObjectCreatedDispatchesTestDoublePartialMockObjectCreatedEvent(): void
{
$className = self::class;
$methodNames = [
Expand All @@ -1133,16 +1133,16 @@ public function testTestDoublePartialMockCreatedDispatchesTestDoublePartialMockC
'baz',
];

$subscriber = new class extends RecordingSubscriber implements TestDouble\PartialMockCreatedSubscriber {
public function notify(TestDouble\PartialMockCreated $event): void
$subscriber = new class extends RecordingSubscriber implements TestDouble\PartialMockObjectCreatedSubscriber {
public function notify(TestDouble\PartialMockObjectCreated $event): void
{
$this->record($event);
}
};

$dispatcher = self::createDispatcherWithRegisteredSubscriber(
TestDouble\PartialMockCreatedSubscriber::class,
TestDouble\PartialMockCreated::class,
TestDouble\PartialMockObjectCreatedSubscriber::class,
TestDouble\PartialMockObjectCreated::class,
$subscriber
);

Expand All @@ -1153,7 +1153,7 @@ public function notify(TestDouble\PartialMockCreated $event): void
$telemetrySystem
);

$emitter->testDoublePartialMockCreated(
$emitter->testDoublePartialMockObjectCreated(
$className,
...$methodNames
);
Expand All @@ -1162,7 +1162,7 @@ public function notify(TestDouble\PartialMockCreated $event): void

$event = $subscriber->lastRecordedEvent();

$this->assertInstanceOf(TestDouble\PartialMockCreated::class, $event);
$this->assertInstanceOf(TestDouble\PartialMockObjectCreated::class, $event);

$this->assertSame($className, $event->className());
$this->assertSame($methodNames, $event->methodNames());
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/Event/TestDouble/PartialMockCreatedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
use PHPUnit\Event\AbstractEventTestCase;

/**
* @covers \PHPUnit\Event\TestDouble\PartialMockCreated
* @covers \PHPUnit\Event\TestDouble\PartialMockObjectCreated
*/
final class PartialMockCreatedTest extends AbstractEventTestCase
final class PartialMockObjectCreatedTest extends AbstractEventTestCase
{
public function testConstructorSetsValues(): void
{
Expand All @@ -26,7 +26,7 @@ public function testConstructorSetsValues(): void
'baz',
];

$event = new PartialMockCreated(
$event = new PartialMockObjectCreated(
$telemetryInfo,
$className,
...$methodNames
Expand Down

0 comments on commit 5cff4bc

Please sign in to comment.