|
18 | 18 | use Tripod\Mongo\MongoGraph; |
19 | 19 | use Tripod\Mongo\TransactionLog; |
20 | 20 | use Tripod\Mongo\Updates; |
| 21 | +use Tripod\Test\Mongo\Mocks\Cursor as FakeCursor; |
21 | 22 |
|
22 | 23 | class MongoTripodViewsTest extends MongoTripodTestBase |
23 | 24 | { |
@@ -1970,7 +1971,8 @@ public function testCursorNoExceptions(): void |
1970 | 1971 | ->setConstructorArgs([new Manager(), 'db', 'view']) |
1971 | 1972 | ->onlyMethods(['find']) |
1972 | 1973 | ->getMock(); |
1973 | | - $mockCursor = $this->getMockBuilder(ArrayIterator::class) |
| 1974 | + $mockCursor = $this->getMockBuilder(FakeCursor::class) |
| 1975 | + ->setConstructorArgs([[]]) |
1974 | 1976 | ->onlyMethods(['rewind']) |
1975 | 1977 | ->getMock(); |
1976 | 1978 |
|
@@ -2029,7 +2031,8 @@ public function testCursorExceptionThrown(): void |
2029 | 2031 | ->setConstructorArgs([new Manager(), 'db', 'view']) |
2030 | 2032 | ->onlyMethods(['findOne', 'find']) |
2031 | 2033 | ->getMock(); |
2032 | | - $mockCursor = $this->getMockBuilder(ArrayIterator::class) |
| 2034 | + $mockCursor = $this->getMockBuilder(FakeCursor::class) |
| 2035 | + ->setConstructorArgs([[]]) |
2033 | 2036 | ->onlyMethods(['rewind']) |
2034 | 2037 | ->getMock(); |
2035 | 2038 |
|
@@ -2089,7 +2092,8 @@ public function testCursorNoExceptionThrownWhenCursorThrowsSomeExceptions(): voi |
2089 | 2092 | ->setConstructorArgs([new Manager(), 'db', 'view']) |
2090 | 2093 | ->onlyMethods(['find', 'findOne']) |
2091 | 2094 | ->getMock(); |
2092 | | - $mockCursor = $this->getMockBuilder(ArrayIterator::class) |
| 2095 | + $mockCursor = $this->getMockBuilder(FakeCursor::class) |
| 2096 | + ->setConstructorArgs([[]]) |
2093 | 2097 | ->onlyMethods(['rewind']) |
2094 | 2098 | ->getMock(); |
2095 | 2099 |
|
@@ -2276,7 +2280,7 @@ public function testBatchViewGeneration(): void |
2276 | 2280 | $docs[] = ['_id' => ['r' => 'tenantLists:batch' . $i, 'c' => 'tenantContexts:DefaultGraph']]; |
2277 | 2281 | } |
2278 | 2282 |
|
2279 | | - $fakeCursor = new ArrayIterator($docs); |
| 2283 | + $fakeCursor = new FakeCursor($docs); |
2280 | 2284 | $configInstance = $this->getMockBuilder(TripodTestConfig::class) |
2281 | 2285 | ->onlyMethods(['getCollectionForView', 'getCollectionForCBD']) |
2282 | 2286 | ->disableOriginalConstructor() |
|
0 commit comments