Sokil\Mongo\EmbeddedDocumentTest::testSetInvalidEmbeddedDocument PHP Method

testSetInvalidEmbeddedDocument() public method

    public function testSetInvalidEmbeddedDocument()
    {
        $profile = new ProfileDocument(array('name' => null));
        $document = new Document($this->collection);
        try {
            $document->set('profile', $profile);
            $this->fail('InvalidDocumentException must be thrown, but method call was successfull');
        } catch (InvalidDocumentException $e) {
            $this->assertSame(array('name' => array('required' => 'REQUIRED_FIELD_EMPTY_MESSAGE')), $e->getDocument()->getErrors());
        }
    }