Sokil\Mongo\DocumentValidationTest::testGetInvalidDocumentFromException PHP Method

testGetInvalidDocumentFromException() public method

    public function testGetInvalidDocumentFromException()
    {
        // mock of document
        $document = $this->getMock('\\Sokil\\Mongo\\Document', array('rules'), array($this->collection));
        $document->expects($this->any())->method('rules')->will($this->returnValue(array(array('some-field-name', 'numeric'))));
        $document->set('some-field-name', 'wrongValue');
        try {
            $document->validate();
            $this->fail('Must be exception');
        } catch (\Sokil\Mongo\Document\InvalidDocumentException $e) {
            $this->assertEquals($document, $e->getDocument());
        }
    }