Sokil\Mongo\DocumentValidationTest::testIsValid_FieldLength_IsMinMax PHP Method

testIsValid_FieldLength_IsMinMax() public method

    public function testIsValid_FieldLength_IsMinMax()
    {
        // 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', 'length', 'is' => 5, 'min' => 98, 'max' => 110))));
        // required field empty
        $this->assertTrue($document->isValid());
        // required field set to wrong value
        $document->set('some-field-name', '1234567');
        $this->assertFalse($document->isValid());
        // required field set to valid value
        $document->set('some-field-name', '12345');
        $this->assertTrue($document->isValid());
    }