Sokil\Mongo\DocumentTest::testDecrement PHP Method

testDecrement() public method

public testDecrement ( )
    public function testDecrement()
    {
        /**
         * Increment unsaved
         */
        $doc = $this->collection->createDocument(array('i' => 10));
        // increment
        $doc->decrement('j', 2);
        $doc->decrement('j', 4);
        // test
        $this->assertEquals(-6, $doc->get('j'));
        // save
        $doc->save();
        /**
         * Test increment of document in cache
         */
        $doc = $this->collection->getDocument($doc->getId());
        $this->assertEquals(-6, $doc->get('j'));
        /**
         * Test increment after reread from db
         */
        $doc = $this->collection->getDocumentDirectly($doc->getId());
        $this->assertEquals(-6, $doc->get('j'));
    }
DocumentTest