Skip to content

Commit ef7043c

Browse files
Cleanup & fix append test
1 parent 91c972d commit ef7043c

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

tests/AppendTest.php

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ public function it_can_append_attributes()
4242
}
4343

4444
/** @test */
45-
public function it_can_append_case_insensitive()
45+
public function it_cannot_append_case_insensitive()
4646
{
47-
$model = $this
47+
$this->expectException(InvalidAppendQuery::class);
48+
49+
$this
4850
->createQueryFromAppendRequest('FullName')
4951
->allowedAppends('fullname')
5052
->first();
51-
52-
$this->assertAttributeLoaded($model, 'fullname');
5353
}
5454

5555
/** @test */
5656
public function it_can_append_collections()
5757
{
5858
$models = $this
5959
->createQueryFromAppendRequest('FullName')
60-
->allowedAppends('fullname')
60+
->allowedAppends('FullName')
6161
->get();
6262

6363
$this->assertCollectionAttributeLoaded($models, 'fullname');
@@ -68,7 +68,7 @@ public function it_can_append_paginates()
6868
{
6969
$models = $this
7070
->createQueryFromAppendRequest('FullName')
71-
->allowedAppends('fullname')
71+
->allowedAppends('FullName')
7272
->paginate();
7373

7474
$this->assertPaginateAttributeLoaded($models, 'fullname');
@@ -160,14 +160,4 @@ protected function assertPaginateAttributeLoaded(LengthAwarePaginator $collectio
160160

161161
$this->assertFalse($hasModelWithoutAttributeLoaded, "The `{$attribute}` attribute was expected but not loaded.");
162162
}
163-
164-
protected function assertSimplePaginateAttributeLoaded(Paginator $collection, string $attribute)
165-
{
166-
$hasModelWithoutAttributeLoaded = $collection
167-
->contains(function (Model $model) use ($attribute) {
168-
return ! array_key_exists($attribute, $model->toArray());
169-
});
170-
171-
$this->assertFalse($hasModelWithoutAttributeLoaded, "The `{$attribute}` attribute was expected but not loaded.");
172-
}
173163
}

0 commit comments

Comments
 (0)