Sokil\Mongo\CollectionTest::testGetDocuments_OneFromPoolOtherDirectly PHP Method

testGetDocuments_OneFromPoolOtherDirectly() public method

    public function testGetDocuments_OneFromPoolOtherDirectly()
    {
        $doc1Id = new \MongoId();
        $doc2Id = new \MongoId();
        $doc3Id = new \MongoId();
        // add documents skipping document pool
        $this->collection->batchInsert(array(array('_id' => $doc1Id, 'param' => 'value1'), array('_id' => $doc2Id, 'param' => 'value2'), array('_id' => $doc3Id, 'param' => 'value3')));
        // load one document to document pool
        $doc1 = $this->collection->getDocument($doc1Id);
        $this->assertNotEmpty($doc1);
        $this->assertInstanceOf('\\Sokil\\Mongo\\Document', $doc1);
        $this->assertEquals('value1', $doc1->param);
        $this->assertEquals(1, $this->collection->documentPoolCount());
        // load all documents
        $documents = $this->collection->getDocuments(array($doc1Id, $doc2Id, $doc3Id));
        $this->assertArrayHasKey((string) $doc1Id, $documents);
        $this->assertArrayHasKey((string) $doc2Id, $documents);
        $this->assertArrayHasKey((string) $doc3Id, $documents);
    }
CollectionTest