24
24
use Doctrine \ODM \MongoDB \Aggregation \Builder ;
25
25
use Doctrine \ODM \MongoDB \Aggregation \Stage \MatchStage as AggregationMatch ;
26
26
use Doctrine \ODM \MongoDB \DocumentManager ;
27
+ use Doctrine \ODM \MongoDB \Iterator \IterableResult ;
27
28
use Doctrine \ODM \MongoDB \Iterator \Iterator ;
28
29
use Doctrine \ODM \MongoDB \Mapping \ClassMetadata ;
29
30
use Doctrine \ODM \MongoDB \Repository \DocumentRepository ;
@@ -49,10 +50,13 @@ public function testGetItemSingleIdentifier(): void
49
50
$ result = new \stdClass ();
50
51
$ iterator ->current ()->willReturn ($ result )->shouldBeCalled ();
51
52
53
+ $ aggregationProphecy = $ this ->prophesize (IterableResult::class);
54
+ $ aggregationProphecy ->getIterator ()->willReturn ($ iterator );
55
+
52
56
$ aggregationBuilderProphecy = $ this ->prophesize (Builder::class);
53
57
$ aggregationBuilderProphecy ->match ()->willReturn ($ matchProphecy ->reveal ())->shouldBeCalled ();
54
58
$ aggregationBuilderProphecy ->hydrate (ProviderDocument::class)->willReturn ($ aggregationBuilderProphecy )->shouldBeCalled ();
55
- $ aggregationBuilderProphecy ->execute ([])->willReturn ($ iterator ->reveal ())->shouldBeCalled ();
59
+ $ aggregationBuilderProphecy ->getAggregation ([])->willReturn ($ aggregationProphecy ->reveal ())->shouldBeCalled ();
56
60
$ aggregationBuilder = $ aggregationBuilderProphecy ->reveal ();
57
61
58
62
$ managerRegistry = $ this ->getManagerRegistry (ProviderDocument::class, $ aggregationBuilder );
@@ -82,10 +86,13 @@ public function testGetItemWithExecuteOptions(): void
82
86
$ result = new \stdClass ();
83
87
$ iterator ->current ()->willReturn ($ result )->shouldBeCalled ();
84
88
89
+ $ aggregationProphecy = $ this ->prophesize (IterableResult::class);
90
+ $ aggregationProphecy ->getIterator ()->willReturn ($ iterator );
91
+
85
92
$ aggregationBuilderProphecy = $ this ->prophesize (Builder::class);
86
93
$ aggregationBuilderProphecy ->match ()->willReturn ($ matchProphecy ->reveal ())->shouldBeCalled ();
87
94
$ 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 ();
89
96
$ aggregationBuilder = $ aggregationBuilderProphecy ->reveal ();
90
97
91
98
$ managerRegistry = $ this ->getManagerRegistry (ProviderDocument::class, $ aggregationBuilder );
@@ -116,10 +123,13 @@ public function testGetItemDoubleIdentifier(): void
116
123
$ result = new \stdClass ();
117
124
$ iterator ->current ()->willReturn ($ result )->shouldBeCalled ();
118
125
126
+ $ aggregationProphecy = $ this ->prophesize (IterableResult::class);
127
+ $ aggregationProphecy ->getIterator ()->willReturn ($ iterator );
128
+
119
129
$ aggregationBuilderProphecy = $ this ->prophesize (Builder::class);
120
130
$ aggregationBuilderProphecy ->match ()->willReturn ($ matchProphecy ->reveal ())->shouldBeCalled ();
121
131
$ aggregationBuilderProphecy ->hydrate (ProviderDocument::class)->willReturn ($ aggregationBuilderProphecy )->shouldBeCalled ();
122
- $ aggregationBuilderProphecy ->execute ([])->willReturn ($ iterator ->reveal ())->shouldBeCalled ();
132
+ $ aggregationBuilderProphecy ->getAggregation ([])->willReturn ($ aggregationProphecy ->reveal ())->shouldBeCalled ();
123
133
$ aggregationBuilder = $ aggregationBuilderProphecy ->reveal ();
124
134
125
135
$ managerRegistry = $ this ->getManagerRegistry (ProviderDocument::class, $ aggregationBuilder );
0 commit comments