diff --git a/tests/Projectors/EloquentZeroDowntimeProjectorTest.php b/tests/Projectors/EloquentZeroDowntimeProjectorTest.php index d3e3e10..89eda8b 100644 --- a/tests/Projectors/EloquentZeroDowntimeProjectorTest.php +++ b/tests/Projectors/EloquentZeroDowntimeProjectorTest.php @@ -12,8 +12,7 @@ class EloquentZeroDowntimeProjectorTest extends TestCase { - /** @test */ - public function it_creates_new_tables_with_the_right_sequences_and_foreign_keys() + public function test_it_creates_new_tables_with_the_right_sequences_and_foreign_keys() { $projector = new PostProjector(); $projector->forReplay()->useConnection('foo'); @@ -39,8 +38,7 @@ public function it_creates_new_tables_with_the_right_sequences_and_foreign_keys( $this->assertEquals(1, $comment->id); } - /** @test */ - public function it_drops_table_and_sequences_on_removal() + public function test_it_drops_table_and_sequences_on_removal() { $projector = new PostProjector(); $projector->forReplay()->useConnection('foobar'); diff --git a/tests/ReplayManagerTest.php b/tests/ReplayManagerTest.php index db7f77b..31d723a 100644 --- a/tests/ReplayManagerTest.php +++ b/tests/ReplayManagerTest.php @@ -11,8 +11,7 @@ class ReplayManagerTest extends TestCase { - /** @test */ - public function it_throws_exception_when_replay_already_exists_on_start() + public function test_it_throws_exception_when_replay_already_exists_on_start() { $manager = new ReplayManager(new InMemoryReplayRepository(), new FakeProjectionist(), new FakeStoredEventRepository()); $manager->createReplay('foo', []); @@ -27,8 +26,7 @@ public function it_throws_exception_when_replay_already_exists_on_start() $this->assertTrue($thrown, "Exception StartReplayException expected but not thrown"); } - /** @test */ - public function it_validates_if_projector_is_configured() + public function test_it_validates_if_projector_is_configured() { $projectionist = new FakeProjectionist(); $repo = new InMemoryReplayRepository(); @@ -42,8 +40,7 @@ public function it_validates_if_projector_is_configured() $this->assertNull($repo->getReplayByKey('foo')); } - /** @test */ - public function it_persists_replay_with_valid_projectors() + public function test_it_persists_replay_with_valid_projectors() { $projectionist = new FakeProjectionist(); $projectionist->addProjector('RegisteredProjector'); @@ -59,8 +56,7 @@ public function it_persists_replay_with_valid_projectors() $this->assertEquals(['RegisteredProjector'], $replay->projectors); } - /** @test */ - public function it_starts_a_replay() + public function test_it_starts_a_replay() { $repo = new InMemoryReplayRepository(); $projectionist = new FakeProjectionist(); @@ -75,8 +71,7 @@ public function it_starts_a_replay() $this->assertEquals(0, $projectionist->replays[0]['startingFrom']); } - /** @test */ - public function it_starts_a_replay_from_last_projected_event() + public function test_it_starts_a_replay_from_last_projected_event() { $repo = new InMemoryReplayRepository(); $projectionist = new FakeProjectionist(); @@ -95,8 +90,7 @@ public function it_starts_a_replay_from_last_projected_event() $this->assertEquals(101, $projectionist->replays[0]['startingFrom']); } - /** @test */ - public function it_gets_replay_lag() + public function test_it_gets_replay_lag() { $repo = new InMemoryReplayRepository(); $projectionist = new FakeProjectionist(); @@ -113,8 +107,7 @@ public function it_gets_replay_lag() $this->assertEquals(44, $manager->getReplayLag('foo')); } - /** @test */ - public function it_enables_projections_when_lag_is_0() + public function test_it_enables_projections_when_lag_is_0() { $repo = new InMemoryReplayRepository(); $projectionist = new FakeProjectionist(); @@ -130,8 +123,7 @@ public function it_enables_projections_when_lag_is_0() $this->assertTrue($replay->projectionsEnabled); } - /** @test */ - public function it_does_not_enable_projections_when_lag_is_not_0() + public function test_it_does_not_enable_projections_when_lag_is_not_0() { $repo = new InMemoryReplayRepository(); $projectionist = new FakeProjectionist(); @@ -155,8 +147,7 @@ public function it_does_not_enable_projections_when_lag_is_not_0() $this->assertTrue($thrown, "exception not thrown"); } - /** @test */ - public function it_calls_projectors_to_put_replay_live() + public function test_it_calls_projectors_to_put_replay_live() { $projector = new FakeProjector(); @@ -174,8 +165,7 @@ public function it_calls_projectors_to_put_replay_live() $this->assertTrue($projector->hasBeenPutLive()); } - /** @test */ - public function it_can_remove_replays() + public function test_it_can_remove_replays() { $projector = new FakeProjector(); diff --git a/tests/ReplaySerializerTest.php b/tests/ReplaySerializerTest.php index 9a03ad0..8b6835c 100644 --- a/tests/ReplaySerializerTest.php +++ b/tests/ReplaySerializerTest.php @@ -8,82 +8,80 @@ class ReplaySerializerTest extends TestCase { - /** @test - * @dataProvider provider - */ - public function it_parses_and_reconstructs_plays(Replay $replay) + /** @dataProvider provider */ + public function test_it_parses_and_reconstructs_plays(Replay $replay) { $data = ReplaySerializer::toArray($replay); // Make sure array can be json encoded $data = json_decode(json_encode($data), true); $reconstructedReplay = ReplaySerializer::fromArray($data); - $this->assertEquals($replay, $reconstructedReplay); + self::assertEquals($replay, $reconstructedReplay); } - public function provider(): array + public static function provider(): array { return [ - [$this->replay()], - [$this->replayWithProjectors()], - [$this->startedReplay()], - [$this->replayInProgress()], - [$this->finishedReplay()], - [$this->twoReplays()], - [$this->enabledProjections()], + [self::replay()], + [self::replayWithProjectors()], + [self::startedReplay()], + [self::replayInProgress()], + [self::finishedReplay()], + [self::twoReplays()], + [self::enabledProjections()], ]; } - private function replay(): Replay + private static function replay(): Replay { return new Replay('foo'); } - private function replayWithProjectors(): Replay + private static function replayWithProjectors(): Replay { - $replay = $this->replay(); + $replay = self::replay(); $replay->addProjector('foobar'); $replay->addProjector('baz'); return $replay; } - private function startedReplay(): Replay + private static function startedReplay(): Replay { - $replay = $this->replayWithProjectors(); + $replay = self::replayWithProjectors(); $replay->started(0, Carbon::parse('2021-01-01 10:00:00')); return $replay; } - private function replayInProgress(): Replay + private static function replayInProgress(): Replay { - $replay = $this->startedReplay(); + $replay = self::startedReplay(); $replay->setLastProjectedEventNumber(10); return $replay; } - private function finishedReplay(): Replay + private static function finishedReplay(): Replay { - $replay = $this->replayInProgress(); + $replay = self::replayInProgress(); $replay->finished(Carbon::parse('2021-01-01 12:00:00')); return $replay; } - private function twoReplays(): Replay + private static function twoReplays(): Replay { - $replay = $this->finishedReplay(); + $replay = self::finishedReplay(); $replay->started(100, Carbon::parse('2021-01-02 14:00:00')); $replay->finished(Carbon::parse('2021-01-02 16:00:00')); return $replay; } - private function enabledProjections(): Replay + private static function enabledProjections(): Replay { - $replay = $this->replay(); + $replay = self::replay(); $replay->enableProjections(); return $replay;