ensureCountIndex() public method

Is a no-op if the generated index is a prefix of an existing one. If you have a similar ensureGetIndex call, call it first.
public ensureCountIndex ( array $fields, boolean $includeRunning ) : void
$fields array fields in count() call to index in same format as \MongoDB\Collection::createIndex()
$includeRunning boolean whether to include the running field in the index
return void
 /**
  * Verifies the behaviour of the Queue when it cannot create an index after 5 attempts.
  *
  * @test
  * @covers ::ensureGetIndex
  * @expectedException \Exception
  * @expectedExceptionMessage couldnt create index after 5 attempts
  */
 public function ensureIndexCannotBeCreatedAfterFiveAttempts()
 {
     $mockCollection = $this->getMockBuilder('\\MongoDB\\Collection')->disableOriginalConstructor()->getMock();
     $mockCollection->method('listIndexes')->willReturn([]);
     $queue = new Queue($mockCollection);
     $queue->ensureCountIndex(['type' => 1], false);
 }