Sokil\Mongo\DocumentValidationTest::testIsValid_FieldInRange_Error_DefaultMessage PHP Method

testIsValid_FieldInRange_Error_DefaultMessage() public method

    public function testIsValid_FieldInRange_Error_DefaultMessage()
    {
        // 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')))));
        // 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' => 'Field "some-field-name" not in range of allowed values in model Sokil\\Mongo\\Validator\\InValidator')), $document->getErrors());
    }