Sokil\Mongo\DocumentValidationTest::testIsValid_FieldInRange_Error_CustomMessage PHP Method

testIsValid_FieldInRange_Error_CustomMessage() public method

    public function testIsValid_FieldInRange_Error_CustomMessage()
    {
        // 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', 'in', 'range' => array('acceptedValue1', 'acceptedValue2'), 'message' => 'not in range'))));
        // required field empty
        $this->assertTrue($document->isValid());
        // required field set to wrong value - default error message
        $document->set('some-field-name', 'wrongValue');
        $this->assertFalse($document->isValid());
        $this->assertEquals(array('some-field-name' => array('in' => 'not in range')), $document->getErrors());
    }