Skip to content

Commit

Permalink
test(graphql): @stream tests fix for "laravel/scout:>=10.11.8".
Browse files Browse the repository at this point in the history
  • Loading branch information
LastDragon-ru committed Nov 28, 2024
1 parent 3d81688 commit 6bd5c78
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 19 deletions.
72 changes: 54 additions & 18 deletions packages/graphql/src/Stream/Streams/ScoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,40 @@ public function testGetItems(): void {

self::assertEquals($expected, [...$items]);
self::assertQueryLogEquals(
[
[
'query' => 'select count(*) as aggregate from "test_objects"',
'bindings' => [],
match ((new RequiresLaravelScout('>=10.11.8'))->isSatisfied()) {
true => [
[
'query' => 'select count(*) as aggregate from "test_objects"',
'bindings' => [],
],
[
'query' => <<<SQL
select *
from "test_objects"
order by "id" asc, "test_objects"."id" desc
limit {$limit} offset {$offset}
SQL
,
'bindings' => [],
],
],
[
'query' => <<<SQL
false => [
[
'query' => 'select count(*) as aggregate from "test_objects"',
'bindings' => [],
],
[
'query' => <<<SQL
select *
from "test_objects"
order by "id" asc, "id" desc
limit {$limit} offset {$offset}
SQL
,
'bindings' => [],
,
'bindings' => [],
],
],
],
},
$query,
);
}
Expand All @@ -111,22 +129,40 @@ public function testGetLength(): void {

self::assertEquals($count, $length);
self::assertQueryLogEquals(
[
[
'query' => 'select count(*) as aggregate from "test_objects"',
'bindings' => [],
match ((new RequiresLaravelScout('>=10.11.8'))->isSatisfied()) {
true => [
[
'query' => 'select count(*) as aggregate from "test_objects"',
'bindings' => [],
],
[
'query' => <<<'SQL'
select *
from "test_objects"
order by "id" asc, "test_objects"."id" desc
limit 1 offset 0
SQL
,
'bindings' => [],
],
],
[
'query' => <<<'SQL'
false => [
[
'query' => 'select count(*) as aggregate from "test_objects"',
'bindings' => [],
],
[
'query' => <<<'SQL'
select *
from "test_objects"
order by "id" asc, "id" desc
limit 1 offset 0
SQL
,
'bindings' => [],
,
'bindings' => [],
],
],
],
},
$query,
);
}
Expand Down
2 changes: 1 addition & 1 deletion phpstan-larastan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ services:
- phpstan.broker.dynamicFunctionReturnTypeExtension

-
class: Larastan\Larastan\ReturnTypes\CollectionFilterDynamicReturnTypeExtension
class: Larastan\Larastan\ReturnTypes\CollectionFilterRejectDynamicReturnTypeExtension
tags:
- phpstan.broker.dynamicMethodReturnTypeExtension

Expand Down

0 comments on commit 6bd5c78

Please sign in to comment.