File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,24 @@ public function ensureGetIndexWithBadAfterSortValue()
141141 $ this ->queue ->ensureGetIndex ([], ['field ' => 'NotAnInt ' ]);
142142 }
143143
144+ /**
145+ * Verifies the behaviour of the Queue when it cannot create an index after 5 attempts.
146+ *
147+ * @test
148+ * @covers ::ensureGetIndex
149+ * @expectedException \Exception
150+ * @expectedExceptionMessage couldnt create index after 5 attempts
151+ */
152+ public function ensureIndexCannotBeCreatedAfterFiveAttempts ()
153+ {
154+ $ mockCollection = $ this ->getMockBuilder ('\MongoDB\Collection ' )->disableOriginalConstructor ()->getMock ();
155+
156+ $ mockCollection ->method ('listIndexes ' )->willReturn ([]);
157+
158+ $ queue = new Queue ($ mockCollection );
159+ $ queue ->ensureCountIndex (['type ' => 1 ], false );
160+ }
161+
144162 /**
145163 * @test
146164 * @covers ::ensureCountIndex
You can’t perform that action at this time.
0 commit comments