Sokil\Mongo\CollectionTest::testInsertMultiple_ValidateError PHP Method

testInsertMultiple_ValidateError() public method

    public function testInsertMultiple_ValidateError()
    {
        // mock collection
        $this->collectionMock = $this->getMock('\\Sokil\\Mongo\\Collection', array('createDocument'), array($this->database, 'phpmongo_test_collection'));
        // mock document
        $documentMock = $this->getMock('Sokil\\Mongo\\Document', array('rules'), array($this->collectionMock));
        // implement validation rules
        $documentMock->expects($this->any())->method('rules')->will($this->returnValue(array(array('a', 'email'))));
        // replace creating document with mocked
        $this->collectionMock->expects($this->once())->method('createDocument')->will($this->returnValue($documentMock));
        // insert multiple
        $this->collectionMock->insertMultiple(array(array('a' => 1, 'b' => 2), array('a' => 3, 'b' => 4)));
    }
CollectionTest