Skip to content

Commit c33bad0

Browse files
committed
Update whereAll/Any tests
1 parent ccbc33a commit c33bad0

File tree

1 file changed

+48
-64
lines changed

1 file changed

+48
-64
lines changed

tests/Query/BuilderTest.php

Lines changed: 48 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,65 +1661,57 @@ function (Builder $elemMatchQuery): void {
16611661
if (method_exists(Builder::class, 'whereAll')) {
16621662
/** @see DatabaseQueryBuilderTest::testWhereAll */
16631663
yield 'whereAll' => [
1664-
[
1665-
'find' => [
1666-
['$and' => [['last_name' => 'Doe'], ['email' => 'Doe']]],
1667-
[], // options
1668-
],
1664+
'find' => [
1665+
['$and' => [['last_name' => 'Doe'], ['email' => 'Doe']]],
16691666
],
1667+
'aggregate' => null,
16701668
fn(Builder $builder) => $builder->whereAll(['last_name', 'email'], 'Doe'),
16711669
];
16721670

16731671
yield 'whereAll operator' => [
1674-
[
1675-
'find' => [
1676-
[
1677-
'$and' => [
1678-
['last_name' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1679-
['email' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1680-
],
1672+
'find' => [
1673+
[
1674+
'$and' => [
1675+
['last_name' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1676+
['email' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
16811677
],
1682-
[], // options
16831678
],
16841679
],
1680+
'aggregate' => null,
16851681
fn(Builder $builder) => $builder->whereAll(['last_name', 'email'], 'not like', '%Doe%'),
16861682
];
16871683

16881684
/** @see DatabaseQueryBuilderTest::testOrWhereAll */
16891685
yield 'orWhereAll' => [
1690-
[
1691-
'find' => [
1692-
[
1693-
'$or' => [
1694-
['first_name' => 'John'],
1695-
['$and' => [['last_name' => 'Doe'], ['email' => 'Doe']]],
1696-
],
1686+
'find' => [
1687+
[
1688+
'$or' => [
1689+
['first_name' => 'John'],
1690+
['$and' => [['last_name' => 'Doe'], ['email' => 'Doe']]],
16971691
],
1698-
[], // options
16991692
],
17001693
],
1694+
'aggregate' => null,
17011695
fn(Builder $builder) => $builder
17021696
->where('first_name', 'John')
17031697
->orWhereAll(['last_name', 'email'], 'Doe'),
17041698
];
17051699

17061700
yield 'orWhereAll operator' => [
1707-
[
1708-
'find' => [
1709-
[
1710-
'$or' => [
1711-
['first_name' => new Regex('^.*John.*$', 'i')],
1712-
[
1713-
'$and' => [
1714-
['last_name' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1715-
['email' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1716-
],
1701+
'find' => [
1702+
[
1703+
'$or' => [
1704+
['first_name' => new Regex('^.*John.*$', 'i')],
1705+
[
1706+
'$and' => [
1707+
['last_name' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1708+
['email' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
17171709
],
17181710
],
17191711
],
1720-
[], // options
17211712
],
17221713
],
1714+
'aggregate' => null,
17231715
fn(Builder $builder) => $builder
17241716
->where('first_name', 'like', '%John%')
17251717
->orWhereAll(['last_name', 'email'], 'not like', '%Doe%'),
@@ -1730,65 +1722,57 @@ function (Builder $elemMatchQuery): void {
17301722
if (method_exists(Builder::class, 'whereAny')) {
17311723
/** @see DatabaseQueryBuilderTest::testWhereAny */
17321724
yield 'whereAny' => [
1733-
[
1734-
'find' => [
1735-
['$or' => [['last_name' => 'Doe'], ['email' => 'Doe']]],
1736-
[], // options
1737-
],
1725+
'find' => [
1726+
['$or' => [['last_name' => 'Doe'], ['email' => 'Doe']]],
17381727
],
1728+
'aggregate' => null,
17391729
fn(Builder $builder) => $builder->whereAny(['last_name', 'email'], 'Doe'),
17401730
];
17411731

17421732
yield 'whereAny operator' => [
1743-
[
1744-
'find' => [
1745-
[
1746-
'$or' => [
1747-
['last_name' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1748-
['email' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1749-
],
1733+
'find' => [
1734+
[
1735+
'$or' => [
1736+
['last_name' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1737+
['email' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
17501738
],
1751-
[], // options
17521739
],
17531740
],
1741+
'aggregate' => null,
17541742
fn(Builder $builder) => $builder->whereAny(['last_name', 'email'], 'not like', '%Doe%'),
17551743
];
17561744

17571745
/** @see DatabaseQueryBuilderTest::testOrWhereAny */
17581746
yield 'orWhereAny' => [
1759-
[
1760-
'find' => [
1761-
[
1762-
'$or' => [
1763-
['first_name' => 'John'],
1764-
['$or' => [['last_name' => 'Doe'], ['email' => 'Doe']]],
1765-
],
1747+
'find' => [
1748+
[
1749+
'$or' => [
1750+
['first_name' => 'John'],
1751+
['$or' => [['last_name' => 'Doe'], ['email' => 'Doe']]],
17661752
],
1767-
[], // options
17681753
],
17691754
],
1755+
'aggregate' => null,
17701756
fn(Builder $builder) => $builder
17711757
->where('first_name', 'John')
17721758
->orWhereAny(['last_name', 'email'], 'Doe'),
17731759
];
17741760

17751761
yield 'orWhereAny operator' => [
1776-
[
1777-
'find' => [
1778-
[
1779-
'$or' => [
1780-
['first_name' => new Regex('^.*John.*$', 'i')],
1781-
[
1782-
'$or' => [
1783-
['last_name' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1784-
['email' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1785-
],
1762+
'find' => [
1763+
[
1764+
'$or' => [
1765+
['first_name' => new Regex('^.*John.*$', 'i')],
1766+
[
1767+
'$or' => [
1768+
['last_name' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
1769+
['email' => ['$not' => new Regex('^.*Doe.*$', 'i')]],
17861770
],
17871771
],
17881772
],
1789-
[], // options
17901773
],
17911774
],
1775+
'aggregate' => null,
17921776
fn(Builder $builder) => $builder
17931777
->where('first_name', 'like', '%John%')
17941778
->orWhereAny(['last_name', 'email'], 'not like', '%Doe%'),

0 commit comments

Comments
 (0)