2424use Doctrine \ODM \MongoDB \Aggregation \Builder ;
2525use Doctrine \ODM \MongoDB \Aggregation \Stage \MatchStage as AggregationMatch ;
2626use Doctrine \ODM \MongoDB \DocumentManager ;
27+ use Doctrine \ODM \MongoDB \Iterator \IterableResult ;
2728use Doctrine \ODM \MongoDB \Iterator \Iterator ;
2829use Doctrine \ODM \MongoDB \Mapping \ClassMetadata ;
2930use Doctrine \ODM \MongoDB \Repository \DocumentRepository ;
@@ -49,10 +50,13 @@ public function testGetItemSingleIdentifier(): void
4950 $ result = new \stdClass ();
5051 $ iterator ->current ()->willReturn ($ result )->shouldBeCalled ();
5152
53+ $ aggregationProphecy = $ this ->prophesize (IterableResult::class);
54+ $ aggregationProphecy ->getIterator ()->willReturn ($ iterator );
55+
5256 $ aggregationBuilderProphecy = $ this ->prophesize (Builder::class);
5357 $ aggregationBuilderProphecy ->match ()->willReturn ($ matchProphecy ->reveal ())->shouldBeCalled ();
5458 $ aggregationBuilderProphecy ->hydrate (ProviderDocument::class)->willReturn ($ aggregationBuilderProphecy )->shouldBeCalled ();
55- $ aggregationBuilderProphecy ->execute ([])->willReturn ($ iterator ->reveal ())->shouldBeCalled ();
59+ $ aggregationBuilderProphecy ->getAggregation ([])->willReturn ($ aggregationProphecy ->reveal ())->shouldBeCalled ();
5660 $ aggregationBuilder = $ aggregationBuilderProphecy ->reveal ();
5761
5862 $ managerRegistry = $ this ->getManagerRegistry (ProviderDocument::class, $ aggregationBuilder );
@@ -82,10 +86,13 @@ public function testGetItemWithExecuteOptions(): void
8286 $ result = new \stdClass ();
8387 $ iterator ->current ()->willReturn ($ result )->shouldBeCalled ();
8488
89+ $ aggregationProphecy = $ this ->prophesize (IterableResult::class);
90+ $ aggregationProphecy ->getIterator ()->willReturn ($ iterator );
91+
8592 $ aggregationBuilderProphecy = $ this ->prophesize (Builder::class);
8693 $ aggregationBuilderProphecy ->match ()->willReturn ($ matchProphecy ->reveal ())->shouldBeCalled ();
8794 $ aggregationBuilderProphecy ->hydrate (ProviderDocument::class)->willReturn ($ aggregationBuilderProphecy )->shouldBeCalled ();
88- $ aggregationBuilderProphecy ->execute (['allowDiskUse ' => true ])->willReturn ($ iterator ->reveal ())->shouldBeCalled ();
95+ $ aggregationBuilderProphecy ->getAggregation (['allowDiskUse ' => true ])->willReturn ($ aggregationProphecy ->reveal ())->shouldBeCalled ();
8996 $ aggregationBuilder = $ aggregationBuilderProphecy ->reveal ();
9097
9198 $ managerRegistry = $ this ->getManagerRegistry (ProviderDocument::class, $ aggregationBuilder );
@@ -116,10 +123,13 @@ public function testGetItemDoubleIdentifier(): void
116123 $ result = new \stdClass ();
117124 $ iterator ->current ()->willReturn ($ result )->shouldBeCalled ();
118125
126+ $ aggregationProphecy = $ this ->prophesize (IterableResult::class);
127+ $ aggregationProphecy ->getIterator ()->willReturn ($ iterator );
128+
119129 $ aggregationBuilderProphecy = $ this ->prophesize (Builder::class);
120130 $ aggregationBuilderProphecy ->match ()->willReturn ($ matchProphecy ->reveal ())->shouldBeCalled ();
121131 $ aggregationBuilderProphecy ->hydrate (ProviderDocument::class)->willReturn ($ aggregationBuilderProphecy )->shouldBeCalled ();
122- $ aggregationBuilderProphecy ->execute ([])->willReturn ($ iterator ->reveal ())->shouldBeCalled ();
132+ $ aggregationBuilderProphecy ->getAggregation ([])->willReturn ($ aggregationProphecy ->reveal ())->shouldBeCalled ();
123133 $ aggregationBuilder = $ aggregationBuilderProphecy ->reveal ();
124134
125135 $ managerRegistry = $ this ->getManagerRegistry (ProviderDocument::class, $ aggregationBuilder );
0 commit comments