Sokil\Mongo\EmbeddedDocumentTest::testPushInvalidEmbeddedDocument PHP Method

testPushInvalidEmbeddedDocument() public method

    public function testPushInvalidEmbeddedDocument()
    {
        $document = new Document($this->collection);
        try {
            $document->push('profiles', new ProfileDocument(array('name' => null)));
            $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());
        }
    }