Skip to content

Commit

Permalink
Fix: Rename TestCase\BeforeClassCalled to Test\BeforeFirstTestMethodC…
Browse files Browse the repository at this point in the history
…alled

Related to #44.

Co-authored-by: Andreas Möller <am@localheinz.com>
Co-authored-by: Arne Blankerts <Arne@Blankerts.de>
  • Loading branch information
localheinz and theseer committed Feb 16, 2021
1 parent f20da82 commit 348e407
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/Event/DispatchingEmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ public function testAfterLastTestMethodFinished(): void
$this->dispatcher->dispatch(new Test\AfterLastTestMethodFinished($this->telemetryInfo()));
}

public function testCaseBeforeClassCalled(): void
public function testBeforeFirstTestMethodCalled(): void
{
$this->dispatcher->dispatch(new TestCase\BeforeClassCalled($this->telemetryInfo()));
$this->dispatcher->dispatch(new Test\BeforeFirstTestMethodCalled($this->telemetryInfo()));
}

public function testBeforeFirstTestMethodFinished(): void
Expand Down
2 changes: 1 addition & 1 deletion src/Event/Emitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testAfterTestMethodFinished(): void;

public function testAfterLastTestMethodFinished(): void;

public function testCaseBeforeClassCalled(): void;
public function testBeforeFirstTestMethodCalled(): void;

public function testBeforeFirstTestMethodFinished(): void;

Expand Down
2 changes: 1 addition & 1 deletion src/Event/Registry.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ private static function registerDefaultTypes(): void
GlobalState\Restored::class,
Test\AfterLastTestMethodFinished::class,
Test\AfterTestMethodFinished::class,
Test\BeforeFirstTestMethodCalled::class,
Test\BeforeFirstTestMethodFinished::class,
Test\Errored::class,
Test\Failed::class,
Expand All @@ -78,7 +79,6 @@ private static function registerDefaultTypes(): void
Test\SkippedDueToUnsatisfiedRequirements::class,
Test\SkippedIncomplete::class,
Test\SkippedWithMessage::class,
TestCase\BeforeClassCalled::class,
TestCase\SetUpBeforeClassFinished::class,
TestCase\SetUpFinished::class,
TestCase\TearDownAfterClassFinished::class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\TestCase;
namespace PHPUnit\Event\Test;

use PHPUnit\Event\Event;
use PHPUnit\Event\Telemetry;

final class BeforeClassCalled implements Event
final class BeforeFirstTestMethodCalled implements Event
{
private Telemetry\Info $telemetryInfo;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\TestCase;
namespace PHPUnit\Event\Test;

use PHPUnit\Event\Subscriber;

interface BeforeClassCalledSubscriber extends Subscriber
interface BeforeFirstTestMethodCalledSubscriber extends Subscriber
{
public function notify(BeforeClassCalled $event): void;
public function notify(BeforeFirstTestMethodCalled $event): void;
}
2 changes: 1 addition & 1 deletion src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ public function runBare(): void
$this->{$method}();
}

Event\Registry::emitter()->testCaseBeforeClassCalled();
Event\Registry::emitter()->testBeforeFirstTestMethodCalled();
}

$this->setDoesNotPerformAssertionsFromAnnotation();
Expand Down
2 changes: 1 addition & 1 deletion tests/_files/NullEmitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function testAfterLastTestMethodFinished(): void
{
}

public function testCaseBeforeClassCalled(): void
public function testBeforeFirstTestMethodCalled(): 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 @@ -728,18 +728,18 @@ public function notify(Test\AfterLastTestMethodFinished $event): void
$this->assertInstanceOf(Test\AfterLastTestMethodFinished::class, $subscriber->lastRecordedEvent());
}

public function testTestCaseBeforeClassCalledDispatchesTestCaseBeforeClassCalledEvent(): void
public function testTestBeforeFirstTestMethodCalledDispatchesTestBeforeFirstTestMethodEvent(): void
{
$subscriber = new class extends RecordingSubscriber implements TestCase\BeforeClassCalledSubscriber {
public function notify(TestCase\BeforeClassCalled $event): void
$subscriber = new class extends RecordingSubscriber implements Test\BeforeFirstTestMethodCalledSubscriber {
public function notify(Test\BeforeFirstTestMethodCalled $event): void
{
$this->record($event);
}
};

$dispatcher = self::createDispatcherWithRegisteredSubscriber(
TestCase\BeforeClassCalledSubscriber::class,
TestCase\BeforeClassCalled::class,
Test\BeforeFirstTestMethodCalledSubscriber::class,
Test\BeforeFirstTestMethodCalled::class,
$subscriber
);

Expand All @@ -750,10 +750,10 @@ public function notify(TestCase\BeforeClassCalled $event): void
$telemetrySystem
);

$emitter->testCaseBeforeClassCalled();
$emitter->testBeforeFirstTestMethodCalled();

$this->assertSame(1, $subscriber->recordedEventCount());
$this->assertInstanceOf(TestCase\BeforeClassCalled::class, $subscriber->lastRecordedEvent());
$this->assertInstanceOf(Test\BeforeFirstTestMethodCalled::class, $subscriber->lastRecordedEvent());
}

public function testTestBeforeFirstTestMethodFinishedDispatchesTestBeforeFirstTestMethodFinishedEvent(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event\TestCase;
namespace PHPUnit\Event\Test;

use PHPUnit\Event\AbstractEventTestCase;

/**
* @covers \PHPUnit\Event\TestCase\BeforeClassCalled
* @covers \PHPUnit\Event\Test\BeforeFirstTestMethodCalled
*/
final class BeforeClassCalledTest extends AbstractEventTestCase
final class BeforeFirstTestMethodCalledTest extends AbstractEventTestCase
{
public function testConstructorSetsValues(): void
{
$telemetryInfo = self::createTelemetryInfo();

$event = new BeforeClassCalled($telemetryInfo);
$event = new BeforeFirstTestMethodCalled($telemetryInfo);

$this->assertSame($telemetryInfo, $event->telemetryInfo());
}
Expand Down

0 comments on commit 348e407

Please sign in to comment.