Sokil\Mongo\PersistenceTest::testDetach PHP Method

testDetach() public method

public testDetach ( Sokil\Mongo\Persistence $persistence )
$persistence Sokil\Mongo\Persistence
    public function testDetach(Persistence $persistence)
    {
        $document = $this->collection->createDocument(array('param' => 'value'));
        $this->assertFalse($persistence->contains($document));
        // attach document
        $persistence->persist($document);
        // check if document in persistence
        $this->assertTrue($persistence->contains($document));
        // detach document
        $persistence->detach($document);
        // check if document in persistence
        $this->assertFalse($persistence->contains($document));
    }