Skip to content

Commit 094f84d

Browse files
committed
Adapt tests to new Collection subtype DSL
Update Filtered::by()->name(), Composite::with()->name(), and Typed::by()->name() calls to the new direct static call syntax (Filtered::name(), Composite::name(), Typed::name()).
1 parent 99b3f6e commit 094f84d

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

tests/Hydrators/FlatNumTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function hydrateResolvesTypedEntity(): void
9191

9292
$factory = new EntityFactory(entityNamespace: 'Respect\Relational\Hydrators\\');
9393
$hydrator = new FlatNum($stmt);
94-
$collection = Typed::by('type')->issue();
94+
$collection = Typed::issue('type');
9595
$result = $hydrator->hydrate($row, $collection, $factory);
9696

9797
$this->assertNotFalse($result);

tests/MapperTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@ public function testReusingRegisteredFilteredCollectionsKeepsTheirFilteringOnFet
836836
public function testRegisteredFilteredCollectionsByColumnKeepsTheirFiltering(): void
837837
{
838838
$mapper = $this->mapper;
839-
$mapper->post = Filtered::by('title')->post();
839+
$mapper->post = Filtered::post('title');
840840
$post = $mapper->post->fetch();
841841
$this->assertEquals(
842842
(object) ['id' => '5', 'title' => 'Post Title'],
@@ -853,7 +853,7 @@ public function testRegisteredFilteredCollectionsByColumnKeepsTheirFiltering():
853853
public function testRegisteredFilteredCollectionsByColumnKeepsTheirFilteringOnFetchAll(): void
854854
{
855855
$mapper = $this->mapper;
856-
$mapper->post = Filtered::by('title')->post();
856+
$mapper->post = Filtered::post('title');
857857
$post = $mapper->post->fetchAll();
858858
$post = $post[0];
859859
$this->assertEquals(
@@ -871,7 +871,7 @@ public function testRegisteredFilteredCollectionsByColumnKeepsTheirFilteringOnFe
871871
public function testRegisteredFilteredWildcardCollectionsKeepsTheirFiltering(): void
872872
{
873873
$mapper = $this->mapper;
874-
$mapper->post = Filtered::by('*')->post();
874+
$mapper->post = Filtered::post('*');
875875
$post = $mapper->post->fetch();
876876
$this->assertEquals((object) ['id' => '5'], $post);
877877
$post->title = 'Title Changed';
@@ -885,7 +885,7 @@ public function testRegisteredFilteredWildcardCollectionsKeepsTheirFiltering():
885885
public function testRegisteredFilteredWildcardCollectionsKeepsTheirFilteringOnFetchAll(): void
886886
{
887887
$mapper = $this->mapper;
888-
$mapper->post = Filtered::by('*')->post();
888+
$mapper->post = Filtered::post('*');
889889
$post = $mapper->post->fetchAll();
890890
$post = $post[0];
891891
$this->assertEquals((object) ['id' => '5'], $post);
@@ -900,7 +900,7 @@ public function testRegisteredFilteredWildcardCollectionsKeepsTheirFilteringOnFe
900900
public function testFetchingRegisteredFilteredCollectionsAlongsideNormal(): void
901901
{
902902
$mapper = $this->mapper;
903-
$mapper->post = Filtered::by('*')->post()->author();
903+
$mapper->post = Filtered::post('*')->author();
904904
$post = $mapper->post->fetchAll();
905905
$post = $post[0];
906906
$this->assertEquals(
@@ -922,7 +922,7 @@ public function testFetchingRegisteredFilteredCollectionsAlongsideNormal(): void
922922
public function testCompositesBringResultsFromTwoTables(): void
923923
{
924924
$mapper = $this->mapper;
925-
$mapper->postComment = Composite::with(['comment' => ['text']])->post()->author();
925+
$mapper->postComment = Composite::post(['comment' => ['text']])->author();
926926
$post = $mapper->postComment->fetch();
927927
$this->assertEquals(
928928
(object) ['name' => 'Author 1', 'id' => 1],
@@ -943,7 +943,7 @@ public function testCompositesBringResultsFromTwoTables(): void
943943
public function testCompositesPersistsResultsOnTwoTables(): void
944944
{
945945
$mapper = $this->mapper;
946-
$mapper->postComment = Composite::with(['comment' => ['text']])->post()->author();
946+
$mapper->postComment = Composite::post(['comment' => ['text']])->author();
947947
$post = $mapper->postComment->fetch();
948948
$this->assertEquals(
949949
(object) ['name' => 'Author 1', 'id' => 1],
@@ -974,7 +974,7 @@ public function testCompositesPersistsResultsOnTwoTables(): void
974974
public function testCompositesPersistsNewlyCreatedEntitiesOnTwoTables(): void
975975
{
976976
$mapper = $this->mapper;
977-
$mapper->postComment = Composite::with(['comment' => ['text']])->post()->author();
977+
$mapper->postComment = Composite::post(['comment' => ['text']])->author();
978978
$post = (object) ['text' => 'Comment X', 'title' => 'Post X', 'id' => null];
979979
$post->author_id = (object) ['name' => 'Author X', 'id' => null];
980980
$mapper->postComment->persist($post);
@@ -993,7 +993,7 @@ public function testCompositesPersistsNewlyCreatedEntitiesOnTwoTables(): void
993993
public function testCompositesPersistDoesNotDropColumnsWithMatchingValues(): void
994994
{
995995
$mapper = $this->mapper;
996-
$mapper->postComment = Composite::with(['comment' => ['text']])->post()->author();
996+
$mapper->postComment = Composite::post(['comment' => ['text']])->author();
997997
$post = $mapper->postComment->fetch();
998998
$post->title = 'Same Value';
999999
$post->text = 'Same Value';
@@ -1010,7 +1010,7 @@ public function testCompositesPersistDoesNotDropColumnsWithMatchingValues(): voi
10101010
public function testCompositesAll(): void
10111011
{
10121012
$mapper = $this->mapper;
1013-
$mapper->postComment = Composite::with(['comment' => ['text']])->post()->author();
1013+
$mapper->postComment = Composite::post(['comment' => ['text']])->author();
10141014
$post = $mapper->postComment->fetchAll();
10151015
$post = $post[0];
10161016
$this->assertEquals(
@@ -1042,7 +1042,7 @@ public function testCompositesAll(): void
10421042
public function testTyped(): void
10431043
{
10441044
$mapper = new Mapper($this->conn, new EntityFactory(entityNamespace: '\Respect\Relational\\'));
1045-
$mapper->typedIssues = Typed::by('type')->issues();
1045+
$mapper->typedIssues = Typed::issues('type');
10461046
$issues = $mapper->typedIssues->fetchAll();
10471047
$this->assertInstanceOf('\\Respect\Relational\\Bug', $issues[0]);
10481048
$this->assertInstanceOf('\\Respect\Relational\\Improvement', $issues[1]);
@@ -1059,7 +1059,7 @@ public function testTyped(): void
10591059
public function testTypedSingle(): void
10601060
{
10611061
$mapper = new Mapper($this->conn, new EntityFactory(entityNamespace: '\Respect\Relational\\'));
1062-
$mapper->typedIssues = Typed::by('type')->issues();
1062+
$mapper->typedIssues = Typed::issues('type');
10631063
$issue = $mapper->typedIssues->fetch();
10641064
$this->assertInstanceOf('\\Respect\Relational\\Bug', $issue);
10651065
$this->assertEquals((array) $this->issues[0], (array) $issue);

0 commit comments

Comments
 (0)