@@ -48,7 +48,7 @@ public function it_can_validate_same(): void
4848 * @test
4949 * @dataProvider hundredTimes
5050 */
51- public function it_can_validate_related (): void
51+ public function it_can_validate_relationship (): void
5252 {
5353 $ post = Post::create ([
5454 'title ' => self ::randomString (),
@@ -59,31 +59,16 @@ public function it_can_validate_related(): void
5959 'post_id ' => $ post ->getKey (),
6060 ]);
6161
62+ ModelAssertions::assertRelated ($ post , 'comments ' , Comment::class);
6263 ModelAssertions::assertRelated ($ post , 'comments ' , $ comment );
63- ModelAssertions::assertRelated ($ comment , 'post ' , $ post );
64- }
65-
66- /**
67- * @test
68- * @dataProvider hundredTimes
69- */
70- public function it_can_validate_relationship (): void
71- {
72- $ post = Post::create ([
73- 'title ' => self ::randomString (),
74- ]);
7564
76- $ comment = Comment::create ([
77- 'message ' => self ::randomString (),
78- 'post_id ' => $ post ->getKey (),
79- ]);
65+ ModelAssertions::assertRelated ($ post , 'comments ' , Comment::class, HasMany::class);
66+ ModelAssertions::assertRelated ($ post , 'comments ' , $ comment , HasMany::class);
8067
81- ModelAssertions::assertRelationship ($ post , 'comments ' , Comment::class);
82- ModelAssertions::assertRelationship ($ post , 'comments ' , Comment::class, HasMany::class);
83- ModelAssertions::assertRelationship ($ post , 'comments ' , $ comment , HasMany::class);
68+ ModelAssertions::assertRelated ($ comment , 'post ' , Post::class);
69+ ModelAssertions::assertRelated ($ comment , 'post ' , $ post );
8470
85- ModelAssertions::assertRelationship ($ comment , 'post ' , Post::class);
86- ModelAssertions::assertRelationship ($ comment , 'post ' , Post::class, BelongsTo::class);
87- ModelAssertions::assertRelationship ($ comment , 'post ' , $ post , BelongsTo::class);
71+ ModelAssertions::assertRelated ($ comment , 'post ' , Post::class, BelongsTo::class);
72+ ModelAssertions::assertRelated ($ comment , 'post ' , $ post , BelongsTo::class);
8873 }
8974}
0 commit comments