Skip to content

Commit 1012bf1

Browse files
committed
Override protected method to be mocked
1 parent 40fa605 commit 1012bf1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Illuminate/Database/Query/Builder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,7 +1584,7 @@ public function chunkById(int $count, callable $callback, string|null $column =
15841584
* @param string $column
15851585
* @return $this
15861586
*/
1587-
private function forPageAfterId(int $perPage = 15, int|null $lastId = 0, string $column = 'id'): Builder
1587+
protected function forPageAfterId(int $perPage = 15, int|null $lastId = 0, string $column = 'id'): Builder
15881588
{
15891589
$this->orders = $this->removeExistingOrdersFor($column);
15901590

@@ -1602,7 +1602,7 @@ private function forPageAfterId(int $perPage = 15, int|null $lastId = 0, string
16021602
* @param string $column
16031603
* @return array
16041604
*/
1605-
private function removeExistingOrdersFor(string $column): array
1605+
protected function removeExistingOrdersFor(string $column): array
16061606
{
16071607
return Collection::make($this->orders)
16081608
->reject(function ($order) use ($column) {

tests/Database/DatabaseQueryBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,7 +1524,7 @@ protected function getMockQueryBuilder(): MockInterface|Builder
15241524
m::mock(ConnectionInterface::class),
15251525
new Grammar,
15261526
m::mock(Processor::class),
1527-
])->makePartial();
1527+
])->makePartial()->shouldAllowMockingProtectedMethods();
15281528
}
15291529

15301530
}

0 commit comments

Comments
 (0)