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

testDeleteOne() public method

public testDeleteOne ( )
    public function testDeleteOne()
    {
        $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' => 1]));
        $expected = ['nRemoved' => 1, 'ok' => true];
        $this->assertSame($expected, $batch->execute());
        $newCollection = $this->getCheckDatabase()->selectCollection('test');
        $this->assertSame(1, $newCollection->count());
    }