public function testStringLengthValidator()
 {
     $strVal = new phStringLengthValidator(array(phStringLengthValidator::INVALID => "Please enter a string between 6 and 8 characters long"));
     $strVal->min(6)->max(8);
     $username = new phFormDataItem('username');
     $username->setValidator($strVal);
     $username->bind('short');
     $this->assertFalse($strVal->validate($username->getValue(), $username), 'The validator is correctly not valid');
     $messages = $this->extractErrorMessages($username->getErrors());
     $this->assertTrue(in_array('Please enter a string between 6 and 8 characters long', $messages), 'error message set properly');
     $username->bind('tooloooooooong');
     $this->assertFalse($strVal->validate($username->getValue(), $username), 'The validator is correctly not valid');
     $username->bind('justfine');
     $this->assertTrue($strVal->validate($username->getValue(), $username), 'The validator is valid');
     $strVal->min(6)->max(null);
     $username->bind('short');
     $this->assertFalse($strVal->validate($username->getValue(), $username), 'The validator is correctly not valid');
     $username->bind('123456');
     $this->assertTrue($strVal->validate($username->getValue(), $username), 'The validator is correctly valid');
     $strVal->min(null)->max(10);
     $username->bind('');
     $this->assertTrue($strVal->validate($username->getValue(), $username), 'The validator is correctly valid');
     $username->bind('1234567890');
     $this->assertTrue($strVal->validate($username->getValue(), $username), 'The validator is correctly valid');
     $username->bind('waaaaaaaayyyytooooolong');
     $this->assertFalse($strVal->validate($username->getValue(), $username), 'The validator is correctly not valid');
 }