Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit a80cdf7

Browse files
committed
Use case operator throughout tests
1 parent 4e937db commit a80cdf7

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

tests/Builder/Expression/ConvertOperatorTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
use MongoDB\Builder\Stage;
1111
use MongoDB\Tests\Builder\PipelineTestCase;
1212

13-
use function MongoDB\object;
14-
1513
/**
1614
* Test $convert expression
1715
*/
@@ -43,7 +41,7 @@ public function testExample(): void
4341
Stage::project(
4442
totalPrice: Expression::switch(
4543
branches: [
46-
object(
44+
Expression::case(
4745
case: Expression::eq(
4846
Expression::type(
4947
Expression::fieldPath('convertedPrice'),
@@ -52,7 +50,7 @@ public function testExample(): void
5250
),
5351
then: 'NaN',
5452
),
55-
object(
53+
Expression::case(
5654
case: Expression::eq(
5755
Expression::type(
5856
Expression::fieldPath('convertedQty'),

tests/Builder/Expression/IsNumberOperatorTest.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
use MongoDB\Builder\Stage;
1111
use MongoDB\Tests\Builder\PipelineTestCase;
1212

13-
use function MongoDB\object;
14-
1513
/**
1614
* Test $isNumber expression
1715
*/
@@ -28,35 +26,35 @@ public function testConditionallyModifyFieldsUsingIsNumber(): void
2826
then: Expression::fieldPath('grade'),
2927
else: Expression::switch(
3028
branches: [
31-
object(
29+
Expression::case(
3230
case: Expression::eq(
3331
Expression::fieldPath('grade'),
3432
'A',
3533
),
3634
then: 4,
3735
),
38-
object(
36+
Expression::case(
3937
case: Expression::eq(
4038
Expression::fieldPath('grade'),
4139
'B',
4240
),
4341
then: 3,
4442
),
45-
object(
43+
Expression::case(
4644
case: Expression::eq(
4745
Expression::fieldPath('grade'),
4846
'C',
4947
),
5048
then: 2,
5149
),
52-
object(
50+
Expression::case(
5351
case: Expression::eq(
5452
Expression::fieldPath('grade'),
5553
'D',
5654
),
5755
then: 1,
5856
),
59-
object(
57+
Expression::case(
6058
case: Expression::eq(
6159
Expression::fieldPath('grade'),
6260
'F',

tests/Builder/Expression/ToBoolOperatorTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
use MongoDB\Builder\Stage;
1010
use MongoDB\Tests\Builder\PipelineTestCase;
1111

12-
use function MongoDB\object;
13-
1412
/**
1513
* Test $toBool expression
1614
*/
@@ -22,14 +20,14 @@ public function testExample(): void
2220
Stage::addFields(
2321
convertedShippedFlag: Expression::switch(
2422
branches: [
25-
object(
23+
Expression::case(
2624
case: Expression::eq(
2725
Expression::fieldPath('shipped'),
2826
'false',
2927
),
3028
then: false,
3129
),
32-
object(
30+
Expression::case(
3331
case: Expression::eq(
3432
Expression::fieldPath('shipped'),
3533
'',

0 commit comments

Comments
 (0)