Alcaeus\MongoDbAdapter\Tests\Mongo\MongoDeleteBatchTest::testDeleteMany PHP Method

testDeleteMany() public method

public testDeleteMany ( )
    public function testDeleteMany()
    {
        $collection = $this->getCollection();
        $batch = new \MongoDeleteBatch($collection);
        $document = ['foo' => 'bar'];
        $collection->insert($document);
        unset($document['_id']);
        $collection->insert($document);
        $this->assertTrue($batch->add(['q' => ['foo' => 'bar'], 'limit' => 0]));
        $expected = ['nRemoved' => 2, 'ok' => true];
        $this->assertSame($expected, $batch->execute());
        $newCollection = $this->getCheckDatabase()->selectCollection('test');
        $this->assertSame(0, $newCollection->count());
    }