Skip to content

Commit f99997d

Browse files
committed
test: mongodb mock return types
1 parent 6a9115e commit f99997d

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

tests/Doctrine/Odm/Extension/OrderExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function testApplyToCollectionWithOrderOverriddenWithAssociation(): void
126126
$lookupProphecy = $this->prophesize(Lookup::class);
127127
$lookupProphecy->localField('author')->shouldBeCalled()->willReturn($lookupProphecy);
128128
$lookupProphecy->foreignField('_id')->shouldBeCalled()->willReturn($lookupProphecy);
129-
$lookupProphecy->alias('author_lkup')->shouldBeCalled();
129+
$lookupProphecy->alias('author_lkup')->shouldBeCalled()->willReturn($lookupProphecy);
130130
$aggregationBuilderProphecy->lookup(Dummy::class)->shouldBeCalled()->willReturn($lookupProphecy->reveal());
131131
$aggregationBuilderProphecy->unwind('$author_lkup')->shouldBeCalled();
132132
$aggregationBuilderProphecy->getStage(0)->willThrow(new \OutOfRangeException('message'));

tests/Doctrine/Odm/Extension/PaginationExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,8 @@ private function mockAggregationBuilder(int $expectedOffset, int $expectedLimit)
414414
$skipProphecy->limit($expectedLimit)->shouldBeCalled();
415415
} else {
416416
$matchProphecy = $this->prophesize(AggregationMatch::class);
417-
$matchProphecy->field(Paginator::LIMIT_ZERO_MARKER_FIELD)->shouldBeCalled()->willReturn($matchProphecy);
418-
$matchProphecy->equals(Paginator::LIMIT_ZERO_MARKER)->shouldBeCalled();
417+
$matchProphecy->field(Paginator::LIMIT_ZERO_MARKER_FIELD)->shouldBeCalled()->willReturn($matchProphecy->reveal());
418+
$matchProphecy->equals(Paginator::LIMIT_ZERO_MARKER)->shouldBeCalled()->willReturn($matchProphecy->reveal());
419419
$skipProphecy->match()->shouldBeCalled()->willReturn($matchProphecy->reveal());
420420
}
421421

tests/Doctrine/Odm/State/ItemProviderTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function testGetItemSingleIdentifier(): void
4646

4747
$matchProphecy = $this->prophesize(AggregationMatch::class);
4848
$matchProphecy->field('id')->willReturn($matchProphecy)->shouldBeCalled();
49-
$matchProphecy->equals(1)->shouldBeCalled();
49+
$matchProphecy->equals(1)->shouldBeCalled()->willReturn($matchProphecy);
5050

5151
$iterator = $this->prophesize(Iterator::class);
5252
$result = new \stdClass();
@@ -78,8 +78,8 @@ public function testGetItemWithExecuteOptions(): void
7878
$context = ['foo' => 'bar', 'fetch_data' => true];
7979

8080
$matchProphecy = $this->prophesize(AggregationMatch::class);
81-
$matchProphecy->field('id')->willReturn($matchProphecy)->shouldBeCalled();
82-
$matchProphecy->equals(1)->shouldBeCalled();
81+
$matchProphecy->field('id')->willReturn($matchProphecy->reveal())->shouldBeCalled();
82+
$matchProphecy->equals(1)->shouldBeCalled()->willReturn($matchProphecy->reveal());
8383

8484
$iterator = $this->prophesize(Iterator::class);
8585
$result = new \stdClass();
@@ -112,8 +112,8 @@ public function testGetItemDoubleIdentifier(): void
112112
$matchProphecy = $this->prophesize(AggregationMatch::class);
113113
$matchProphecy->field('ida')->willReturn($matchProphecy)->shouldBeCalled();
114114
$matchProphecy->field('idb')->willReturn($matchProphecy)->shouldBeCalled();
115-
$matchProphecy->equals(1)->shouldBeCalled();
116-
$matchProphecy->equals(2)->shouldBeCalled();
115+
$matchProphecy->equals(1)->shouldBeCalled()->willReturn($matchProphecy);
116+
$matchProphecy->equals(2)->shouldBeCalled()->willReturn($matchProphecy);
117117

118118
$iterator = $this->prophesize(Iterator::class);
119119
$result = new \stdClass();
@@ -147,7 +147,7 @@ public function testAggregationResultExtension(): void
147147

148148
$matchProphecy = $this->prophesize(AggregationMatch::class);
149149
$matchProphecy->field('id')->willReturn($matchProphecy)->shouldBeCalled();
150-
$matchProphecy->equals(1)->shouldBeCalled();
150+
$matchProphecy->equals(1)->shouldBeCalled()->willReturn($matchProphecy);
151151

152152
$aggregationBuilderProphecy = $this->prophesize(Builder::class);
153153
$aggregationBuilderProphecy->match()->willReturn($matchProphecy->reveal())->shouldBeCalled();

0 commit comments

Comments
 (0)