public function testIsValid_FieldLength_MinMax()
{
// 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', 'min' => 5, 'max' => 7))));
// required field empty
$this->assertTrue($document->isValid());
// required field set to smaller of left bound
$document->set('some-field-name', '123');
$this->assertFalse($document->isValid());
// required field length set to equal of left bound
$document->set('some-field-name', '12345');
$this->assertTrue($document->isValid());
// required field length set to length in range
$document->set('some-field-name', '123456');
$this->assertTrue($document->isValid());
// required field length set to equal of right bound
$document->set('some-field-name', '1234567');
$this->assertTrue($document->isValid());
// required field length set to longer of right bound
$document->set('some-field-name', '123456789');
$this->assertFalse($document->isValid());
}