Sokil\Mongo\DocumentBehaviorTest::testBehaviorInCursor PHP Method

testBehaviorInCursor() public method

    public function testBehaviorInCursor()
    {
        $db = $this->collection->getDatabase();
        $db->map('col', array('behaviors' => array('get42' => new SomeBehavior())));
        $collection = $db->getCollection('col');
        $collection->insertMultiple(array(array('key' => 'value1'), array('key' => 'value2'), array('key' => 'value3'), array('key' => 'value4'), array('key' => 'value5')), false);
        foreach ($collection->find() as $document) {
            $this->assertEquals(42, $document->return42());
        }
    }